1.CSV files:
CSV are comma separated files.
I have created a dummy excel file with names,age,vaccine detail,and blood sugar level of 50 people and saved to with (.csv) extension.
So lets open the file using notepad.
The left is excel file with records of patients and right is the comma separated file.Let's convert this data to dataframe.
import pandas as pd
data=pd.read_csv('C:\\Users\\Admin\\Documents\\Patients.csv')
df=pd.DataFrame(data)
print(df)
Dataframe Attributes Part-1.
1. df.at[] to access a single value in row,column pair.
2.df.axes returns list with row axis as 1st element and column axes as second element.
3. df.columns returns the column names present in dataframe.
4. df.dtypes returns the data type of elements in every column.
5.df.empty returns true if dataframe has no elements.
Having value as NaN is not empty.
df.empty returns True only if all the cells in data frame is empty.
No comments:
Post a Comment