Right this moment, let’s learn to use pandas python library. I used GDP data from Kaggle datasets for this train.
We’ll be taught:
- Loading a dataset
- Studying information
- Querying information
Obtain the info from above reference hyperlink and save as gdp.csv
import pandas as pdpd.choices.show.max_rows = 10
# learn information to an information body
df = pd.read_csv("gdp.csv")
Present first 5 rows
df.head(5)
Present final 5 rows
df.tail(5)
Random Pattern
df.pattern(5)
# See particular nation information
df[df["Entity"] = = "China"]
# See particular rows the returned information
If you wish to see see China information within the rows 10 to fifteen
df.iloc[10:15]
# Use question
to get China information
df.question('Nation == "China"')
# Get GDP for checklist of nations
list_of_countries = ["United States", "China", "Japan"]
top3 = df.question('Entity in @list_of_countries')
top3.present(5)
Subsequent, we’ll be taught visualization of information.
Pocket book for reference: https://github.com/sureshgv/machine-learning-tutorials/blob/main/pandas_basics.ipynb