# 识别python中DataFrame中的nanfor i in pfsj.index: if type(pfsj.loc[i]['WZML']) == float: print('float value is ${}'.format(pfsj.loc[i]['WZML'])) elif type(pfsj.loc[i]['WZML']) == str: print('str value is ${}'.format(pfsj.loc[i]['WZML'])) 结果: # 根据结果可知在Dat…
python中的axis究竟是如何定义的呢?他们究竟代表是DataFrame的行还是列? 直接上代码people=DataFrame(np.random.randn(5,5), columns=['a','b','c','d','e'], index=['Joe','Steve','Wes','Jim','Travis']) a b c d eJoe 0.814300 -0.495764 0.3…
在SQL语言中去重是一件相当简单的事情,面对一个表(也可以称之为DataFrame)我们对数据进行去重只需要GROUP BY 就好. select custId,applyNo from tmp.online_service_startloan group by custId,applyNo 1.DataFrame去重 但是对于pandas的DataFrame格式就比较麻烦,我看了其他博客优化了如下三种方案. 我们先引入数据集: import pandas as pd data=pd.read_…
python中的axis究竟是如何定义的呢?他们究竟代表是DataFrame的行还是列? 直接上代码people=DataFrame(np.random.randn(5,5), columns=['a','b','c','d','e'], index=['Joe','Steve','Wes','Jim','Travis']) a b c d eJoe 0.814300 -0.495764 0.…