【发布时间】:2021-09-05 10:00:40
【问题描述】:
我有以下数据框:
import pandas as pd
import numpy as np
df = pd.DataFrame(np.array(([1,2,3], [1,2,3], [1,2,3], [4,5,6])),
columns=['one','two','three'])
#BelowI am sub setting by rows and columns. But I want to have more than just one column.
#In this case Column 'One' and 'two'
small=df[df.one==1].one
这里有什么替代方案?
【问题讨论】:
-
small=df[df.one==1][["one", "two"]]
标签: python pandas filter subset multiple-columns