我有以下數據幀:
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
這里還有什么選擇?
您可以使用
loc
:loc
的第一個元素是想要的行;二是通緝縱隊。如本文所示,它允許掩蔽和索引。