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
原文:https://www.cnblogs.com/wa007/p/11624119.html