datacamp
Data Manipulation with Python
https://app.datacamp.com/learn/skill-tracks/data-manipulation-with-python
chess = chess.set_index('Fide id')
print(chess.head())
print(employee[employee['salary_usd'] == 5000])
HARD
import matplotlib.pyplot as plt
import seaborn as sns
sns.lineplot(x='date', y='level', data=dam_level)
plt.xticks(rotation = 45)
plt.show()
import matplotlib.pyplot as plt
import seaborn as sns
sns.lineplot(x = 'week', y = 'resp', data = patient)
plt.show()
import matplotlib.pyplot as plt
import seaborn as sns
sns.lineplot(x='day', y='order', data=df)
plt.xticks(rotation = 45)
plt.show()
import matplotlib.pyplot as plt
import seaborn as sns
sns.lineplot(
x = 'date',
y = 'close',
data=amazon)
plt.xticks(rotation = 45)
plt.show()
import matplotlib.pyplot as plt
import seaborn as sns
ax = sns.scatterplot(data = steam,
x = "temp",
y = "usage")
plt.show()
import matplotlib.pyplot as plt
import seaborn as sns
sns.scatterplot(x = "age", y = "value", hue = "emissions", data
= valuation)
plt.show()
HARD
import matplotlib.pyplot as plt
import seaborn as sns
ax = sns.scatterplot(x='age',
y='mpg',
hue='emissions',
data=valuation)
plt.show()
HARD
import matplotlib.pyplot as plt
import seaborn as sns
sns.scatterplot(x='GDP per capita', y='Score',
hue='Generosity', data=happiness)
plt.show()
import pandas as pd
column_names = {
'slope_of_peak_exercise_st_segment': 'slope',
'fasting_blood_sugar_gt_120_mg_per_dl': 'fbs'
}
heart_clean = heart.rename(columns=column_names)
print(heart_clean.head())
print(employee.index)
print(chess.dtypes)
import pandas as pd
column_names = [
'temperature',
'luminosity',
'radius'
]
stars.columns = column_names
print(stars.head())
from scipy import stats
iqr_age = stats.iqr(age)
print(iqr_age)
from scipy import stats
IQR = stats.iqr(pH)
print(IQR)
print(chess.isna().sum())
missing_total_by_column = wine.isna().sum()
print(missing_total_by_column)
players_per_country = chess['Federation'].value_counts()
print(players_per_country.head())
HARD
count_by_country = wine['country'].value_counts()
print(count_by_country)
private_employee = employee[['employee_id', 'salary']]
print(private_employee)
print(df.loc[:,["gh owner"]])
import matplotlib.pyplot as plt
import seaborn as sns
ax = sns.swarmplot(x = "measurement",
y = "value",
hue = "species",
data=iris)
plt.show()
import matplotlib.pyplot as plt
import seaborn as sns
sns.jointplot(x = 'age', y = 'value', data = valuation)
plt.show()
import pandas as pd
print(df.stars.apply(lambda x: x / 1000))
HARD
protein = food[(food['protein'] < 10) & (food['protein'] > 4)]
print(protein)
HARD
import matplotlib.pyplot as plt
import seaborn as sns
pets = ["cats", "cats", "dogs", "both", "dogs", "both", "cats", "cats",
"cats",
"dogs", "dogs", "dogs", "dogs", "cats", "cats", "both"]
sns.countplot(pets)
plt.show()