intermediate#python#pandas#data analysis
Data Analysis with Pandas in Python
Learn how to use the Pandas library in Python for data analysis, including data frames, series, and data manipulation.
Introduction to Pandas
Pandas is a powerful library in Python for data analysis and manipulation.
Importing Pandas
You can import Pandas using the following command:
import pandas as pd
Creating Data Frames
A data frame is a two-dimensional table of data with rows and columns.
# create a data frame
data = {'Name': ['John', 'Anna', 'Peter', 'Linda'],
'Age': [28, 24, 35, 32],
'Country': ['USA', 'UK', 'Australia', 'Germany']}
df = pd.DataFrame(data)
print(df)
Data Manipulation
You can perform various operations on data frames, such as filtering, sorting, and grouping.
# filter the data
print(df[df['Age'] > 30])
# sort the data
print(df.sort_values('Age'))