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.
Data Frames
A data frame is a two-dimensional table of data with rows and columns.
import pandas as pd
data = {'Name': ['John', 'Anna', 'Peter', 'Linda'],
'Age': [28, 24, 35, 32],
'Country': ['USA', 'UK', 'Australia', 'Germany']}
df = pd.DataFrame(data)
print(df)
Data Series
A data series is a one-dimensional table of data.
import pandas as pd
data = pd.Series([1, 2, 3, 4, 5])
print(data)
Data Manipulation
You can manipulate data in a data frame using various methods.
import pandas as pd
data = {'Name': ['John', 'Anna', 'Peter', 'Linda'],
'Age': [28, 24, 35, 32],
'Country': ['USA', 'UK', 'Australia', 'Germany']}
df = pd.DataFrame(data)
df['Age'] = df['Age'] + 1
print(df)