AnatoliiShara / Python-Codes-

0 stars 0 forks source link

Pandas /Matplotlib/Seaborn #8

Open AnatoliiShara opened 5 years ago

AnatoliiShara commented 5 years ago

Pandas 1

import pandas as pd df=pd.read_csv (r'C:\med_data.csv') df.head () df.tail () df.info () med_data.groupby(func, axis=0).mean() med_data.groupby(['col1', 'col2'])['col3'].mean()

Pandas 2

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

site_stats = {'Facebook':[100,150,210,270,350], 'Twitter': [200, 300, 400, 500,700], 'LinkedIn': [400, 500, 600, 800, 1000] } df=pd.DataFrame (site_stats) df.plot () sns.kdeplot (df) sns.lmplot('Facebook','LinkedIn', data=df, fit_reg=False) sns.kdeplot(df.Twitter) sns.kdeplot(df.Facebook) sns.kdeplot(df.LinkedIn) sns.kdeplot(df.Facebook, df.Twitter) sns.distplot(df.LinkedIn) plt.hist(df.Facebook, alpha=.3) sns.rugplot(df.Facebook) sns.boxplot([df.Facebook, df.LinkedIn]) sns.violinplot([df.Facebook, df.Twitter]) sns.heatmap([df.Facebook, df.Twitter], annot=True, fmt="d") sns.clustermap(df)