Get first row value of a given column
Here's an example of how you can get the first row value of a given column in a Pandas DataFrame in Python:
import pandas as pd
# Create a sample dataframe
df = pd.DataFrame({'A':[1,2,3], 'B':[4,5,6], 'C':[7,8,9]})
# Get the first row value of column 'B'
first_row_value = df.at[0, 'B']
print(first_row_value)
# Output: 4
Watch a video course
Python - The Practical Guide
You can also use df.loc[0,'B']
or df['B'][0]
instead of df.at[0, 'B']
to get first row value of column 'B'.