2021年09月的文章

第3页

pandas中的isin函数详解

阅读(769)

今天有个同学问到,not in 的逻辑,想用 SQL 的select c_xxx_s from t1 left join t2 on t1.key=t2.key where t2.key is NULL 在 Python 中的逻辑来实现,实...

Pandas数据透视表

阅读(535)

数据透视表是一个非常实用的功能,可以pandas的pivot_table()来实现。 pd.pivot_table(df, index='客户分类', columns='区域',values=['用户ID','7月销量'], aggfunc...

pandas修改列名

阅读(979)

可以直接修改: df.columns = [‘a’,’b’,’c’,’d’] 缺点是每一列的名称都要写出来。 还是用rename比较方便: df...

pandas处理丢失数据

阅读(745)

df.iloc[1,3]=np.nan #给指定位置定义空值 df.iloc[3,1]=np.nan del df['e'] #删除指定行 print(df) print(df.dropna(axis=0,how='any')) # axi...