DataFrame 操做

# 刪除td數據框中的 指定列 

td.drop(columns=['ship-city'],axis=1,inplace=True) #刪除指定列  而且修改掉原始數據

# 刪除td數據框中的 最後一列

td.drop([td.columns[-1]],axis=1,inplace=True)

# 選出指定列 不爲空 的行

td[td['shipping-price'].notnull()&td['item-promotion-discount'].notnull()]   # 指定列不爲空的行

  

去重:python

 

for name in df[['Q']].drop_duplicates()['Q']:
    tdf = df[df['Q']==name]
    print(tdf)
    print('---------------------')
相關文章
相關標籤/搜索