pandas Dataframe filter

df = pd.DataFrame(np.arange(16).reshape((4, 4)),
                 index=['Ohio', 'Colorado', 'Utah', 'New York'],
                 columns=['one', 'two', 'three', 'four'])

df.ix[np.logical_and(df.one != 4, df.three != 6), :3]
df[['B1' in x for x in all_data_st['sku']]]
status.rename(columns={'account number': 'haha'})


writer = pd.ExcelWriter('result.xlsx')
df2.to_excel(writer, sheet_name='Sheet1')
df1.to_excel(writer, sheet_name='Sheet2')
writer.save()

>>> df = pd.DataFrame({'$a':[1,2], '$b': [10,20]})
>>> df.columns = ['a', 'b']

df["C"] = ""
posted @ 2017-04-21 02:07  idlewith  阅读(1113)  评论(0编辑  收藏  举报