有一個大熊貓數據框:如何創建從另一個數據框中一個新的數據幀,並在大熊貓名單
df = pd.DataFrame({'c1':['a','b','c','d'],'c2':[1,2,3,4]})
c1 c2
0 a 1
1 b 2
2 c 3
3 d 4
並有熊貓系列:
list1 = pd.Series(['b','c','e','f'])
Out[6]:
0 a
1 b
2 c
3 e
如何創建一個新的數據幀包含c1在list1中的行。
輸出:
c1 c2
0 b 2
1 c 3
可能使用[使用v從熊貓數據框選擇行的線索](https://stackoverflow.com/questions/12096252/use-a-list-of-values-to-select-rows-from-a-pandas-dataframe) – Zero