python笔记

知识点:
python与:中括号;选取行、选取列;loc与iloc的区别

pd.read_excel()[选取列]
pd.read_excel().loc[按索引选取行]
pd.read_excel().iloc[按行号选取行]

设置列标题、行标题(将第一列作为索引)
https://www.delftstack.com/zh/howto/python-pandas/set-column-as-index-pandas/

pd.read_excel(‘e://example.xlsx’, header = None, index_col = [0])

df = pd.read_excel(‘e://example.xlsx’, header = None)
df. set_index([0], inplace=True)

pd.DataFrame(np.random.randn(5,3),
index=list(‘abcde’),
columns=[‘one’,’two’,’three’])

处理缺失值

df.fillna(0)
df.isnull().any()
df[df.isnull().values==True]

df[df.isna().values==True].count

https://blog.csdn.net/u012387178/article/details/52571725

Original: https://blog.csdn.net/weixin_42683052/article/details/122059355
Author: 基督徒Isaac
Title: python笔记

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/742359/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球