How to return a specific data cell from a pandas DataFrame in the Python programming language. More details: https://statisticsglobe.com/get-speci...
Python code of this video:
import pandas as pd # Load pandas library
data = pd.DataFrame({'x1':range(80, 71, - 1), # Create pandas DataFrame
'x2':['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'],
'x3':range(27, 18, - 1),
'x4':[1, 5, 2, 1, 1, 2, 4, 3, 1]})
print(data) # Print pandas DataFrame
data_cell_1 = data.iat[5, 2] # Using .iat attribute
print(data_cell_1) # Print extracted value
22
data_cell_2 = data.at[1, "x2"] # Using .at attribute
print(data_cell_2) # Print extracted value
b
Follow me on Social Media:
Facebook – Statistics Globe Page: / statisticsglobecom
Facebook – R Programming Group for Discussions & Questions: / statisticsglobe
Facebook – Python Programming Group for Discussions & Questions: / statisticsglobepython
LinkedIn – Statistics Globe Page: / statisticsglobe
LinkedIn – R Programming Group for Discussions & Questions: / 12555223
LinkedIn – Python Programming Group for Discussions & Questions: / 12673534
Twitter: / joachimschork
Music by bensound.com
On this page of the site you can watch the video online Get Specific Element from pandas DataFrame in Python (2 Examples) | Select Cell Value | Column Name with a duration of hours minute second in good quality, which was uploaded by the user Statistics Globe 05 August 2022, share the link with friends and acquaintances, this video has already been watched 1,328 times on youtube and it was liked by 14 viewers. Enjoy your viewing!