数据分析 1
作者:互联网
# some example
import pandas as pd from pandas import Series,DataFrame #数据提取 df = pd.read_excel('./测试数据.xlsx') df.head() #剔除无用的列 df.drop(labels=['none','none1'],axis=1,inplace=True) #列 df.isnull().any(axis=1) indexs = ~(df.isnull().any(axis=1)) df.loc[indexs] len(df.loc[indexs]) df.dropna(0,"any") #drop 系列0是行 df.shape # 填充 n_df = df.fillna(method='bfill',axis=0).fillna(method='ffill',axis=0) #列 n_df.isnull().any(axis=0)#检测哪些列中存在空值
标签:数据分析,loc,df,isnull,indexs,any,axis 来源: https://www.cnblogs.com/zhangchen-sx/p/10864443.html