2017-05-21 10 views
1

からインデックス値を取得するにはどうすればフォーム、私は党=共和党のインデックス値を抽出し、リストに保存したいパンダは - データフレーム

Start Date   End Date    President  Party 
0  04 March 1921 02 August 1923  Warren G Harding Republican 
1  03 August 1923  04 March 1929  Calvin Coolidge Republican 
2  05 March 1929  04 March 1933  Herbert Hoover Republican 
3  05 March 1933  12 April 1945 Franklin D Roosevelt Democratic 
4  13 April 1945 20 January 1953  Harry S Truman Democratic 
5 21 January 1953 20 January 1961 Dwight D Eisenhower Republican 
6 21 January 1961 22 November 1963  John F Kennedy Democratic 
7 23 November 1963 20 January 1969  Lydon B Johnson Democratic 
8 21 January 1969 09 August 1974   Richard Nixon Republican 
9  10 August 1974 20 January 1977   Gerald Ford Republican 
10 21 January 1977 20 January 1981   Jimmy Carter Democratic 
11 21 January 1981 20 January 1989   Ronald Reagan Republican 
12 21 January 1989 20 January 1993  George H W Bush Republican 
13 21 January 1993 20 January 2001   Bill Clinton Democratic 
14 21 January 2001 20 January 2009   George W Bush Republican 
15 21 January 2009 20 January 2017   Barack Obama Democratic 
16 21 January 2017  20 May 2017   Donald Trump Republican 

のパンダのデータフレームを持っています。 これを迅速に実行するためのパンダ機能はありますか?

答えて

1
df.index[df.Party == 'Republican`] 

必要に応じて.tolist()に電話することができます。

関連する問題