Select row from a DataFrame based on values in a column in pandas -


df.loc[df['column_name'] == some_value] 

selects data row or rows in dataframe given specified column.

what equivalent if need specify 'row name' ?

if understand correctly, can pass index directly loc:

example:

df           b group        abc    6   9 abc    3  12 abc    5  56 def    8  32 gfd    4  65 uio    2  87 def    1  31 poi    8   2 fgb    3   3  df.loc['abc']          b group        abc    6   9 abc    3  12 abc    5  56 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -