4 .visualize data using seaborn.

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np

%matplotlib inline

sns.get_dataset_names()

tips = sns.load_dataset("tips")
tips.to_csv('tips.csv')
#sns.relplot(x="total_bill", y="tip", hue="smoker",data=tips);

tips

sns.relplot(x="total_bill", y="tip",data=tips);

sns.set()
# same plotting code as in Matplotlib can produce better visualization!
# Create some data
rng = np.random.RandomState(0)
x = np.linspace(0, 10, 500)
y = np.cumsum(rng.randn(500, 6), 0)
plt.plot(x, y)
plt.legend('ABCDEF', ncol=2, loc='upper left');

sns.distplot(tips['total_bill'])
plt.show()

sns.distplot(tips['total_bill'], kde=False)
plt.show()

sns.distplot(tips['total_bill'], hist=False)
plt.show()

sns.jointplot(x="total_bill", y="tip", data=tips)
plt.show()

sns.scatterplot(x="total_bill", y="tip", data=tips)
plt.show()

sns.set_style("ticks")
sns.pairplot(tips)

sns.stripplot(x="day", y="total_bill", data=tips)
plt.show()

sns.boxplot(x=tips["total_bill"])
plt.show()

sns.violinplot(x=tips["total_bill"])
plt.show()

sns.barplot(x="day", y="total_bill", data=tips)
plt.show()

sns.pointplot(x="time", y="total_bill", data=tips)
plt.show()

sns.regplot(x="total_bill", y="tip", data=tips)
plt.show()

Post a Comment

0 Comments