pandas get value code example

Example 1: df fetch value

val = d2['col_name'].values[0]

Example 2: df fetch value

In [3]: sub_df
Out[3]:
          A         B
2 -0.133653 -0.030854

In [4]: sub_df.iloc[0]
Out[4]:
A   -0.133653
B   -0.030854
Name: 2, dtype: float64

In [5]: sub_df.iloc[0]['A']
Out[5]: -0.13365288513107493

Example 3: how to get value from dataframe pandas

sub_df.iloc[0]

Example 4: extracting values in pandas

note:df is your dataframe of pandas that has your data
your_coloum_name = df['your_coloum_name'].values

Tags:

Misc Example