首页 > 其他 > 详细

日常笔记(20191005

时间:2019-10-05 11:09:29      阅读:85      评论:0      收藏:0      [点我收藏+]

1.函数传递过程中,参数前的单星号代表任意数量的参数,双星号代表dict与参数之间的转换;形参带星号代表将多余的实参整合到该形参里,实参带星号代表将该参数分解传递

2.LabelEcoder:将参数编码为[0, n-1]范围的数字

from sklearn.preprocessing import LabelEncoder
le = LabelEncoder()
le.fit([1,5,67,100])
le.transform([1,1,100,67,5])

3.

one_value_cols = [col for col in train.columns if train[col].nunique() <= 1]

4.折线图

x = [1, 2, 1, 2, 3]
y = [1, 2, 1, 3]
plt.plot(range(len(x)), x, c = r)
plt.plot(range(len(y)), y, c = b)
plt.show()

5.概率分布图

x = [1, 2, 1, 2, 3]
plt.hist(x)
plt.show()

 6.对df某列计数

df[col].value_counts(dropna=False, normalize=True)
返回series

 

日常笔记(20191005

原文:https://www.cnblogs.com/wa007/p/11624119.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!