seaborn
seaborn
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
/Users/satyakumarpalli/anaconda3/lib/python3.10/site-packages/pandas/core/arrays/masked.py:60: UserWarning: Pandas requires version '1.3.6' or newer of 'bottleneck' (version '1.3.5' currently installed).
from pandas.core import (
In [2]: x = np.array([0,1,2,3,4,5,6,7,8,9])
In [9]: sns.distplot(x,hist=False)
plt.show()
/var/folders/nn/9bkkh7612wg2c3gglt0zd9h40000gn/T/ipykernel_19528/2451510118.py:1: UserWarning:
Please adapt your code to use either `displot` (a figure-level function with
similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
For a guide to updating your code to use the new functions, please see
https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751
sns.distplot(x,hist=False)
/Users/satyakumarpalli/anaconda3/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instea
d.
with pd.option_context('mode.use_inf_as_na', True):
In [10]: sns.distplot(np.random.normal(size=1000),hist=False)
plt.show()
/var/folders/nn/9bkkh7612wg2c3gglt0zd9h40000gn/T/ipykernel_19528/4257869092.py:1: UserWarning:
Please adapt your code to use either `displot` (a figure-level function with
similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
For a guide to updating your code to use the new functions, please see
https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751
sns.distplot(np.random.normal(size=1000),hist=False)
/Users/satyakumarpalli/anaconda3/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instea
d.
with pd.option_context('mode.use_inf_as_na', True):
In [12]: sns.distplot(np.random.random(1000),hist=False)
plt.show()
/var/folders/nn/9bkkh7612wg2c3gglt0zd9h40000gn/T/ipykernel_19528/2758520570.py:1: UserWarning:
Please adapt your code to use either `displot` (a figure-level function with
similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
For a guide to updating your code to use the new functions, please see
https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751
sns.distplot(np.random.random(1000),hist=False)
/Users/satyakumarpalli/anaconda3/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instea
d.
with pd.option_context('mode.use_inf_as_na', True):
In [14]: df = pd.read_csv('cleaned_titanic.csv')
In [15]: df
Out[15]: Unnamed: 0 survived pclass sex age sibsp parch fare embarked class who adult_male embark_town alive alone
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
886 886 0 2 male 27.000000 0 0 13.0000 S Second man True Southampton no True
887 887 1 1 female 19.000000 0 0 30.0000 S First woman False Southampton yes True
888 888 0 3 female 29.699118 1 2 23.4500 S Third woman False Southampton no False
889 889 1 1 male 26.000000 0 0 30.0000 C First man True Cherbourg yes True
890 890 0 3 male 32.000000 0 0 7.7500 Q Third man True Queenstown no True
In [20]: sns.distplot(df['age'],hist=False)
plt.show()
/var/folders/nn/9bkkh7612wg2c3gglt0zd9h40000gn/T/ipykernel_19528/2719210385.py:1: UserWarning:
Please adapt your code to use either `displot` (a figure-level function with
similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
For a guide to updating your code to use the new functions, please see
https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751
sns.distplot(df['age'],hist=False)
/Users/satyakumarpalli/anaconda3/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instea
d.
with pd.option_context('mode.use_inf_as_na', True):
In [25]: df1
In [26]: #lineplot
In [27]: sns.lineplot(x='sepal_length',y='sepal_width',data=df1)
plt.show()
/Users/satyakumarpalli/anaconda3/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instea
d.
with pd.option_context('mode.use_inf_as_na', True):
/Users/satyakumarpalli/anaconda3/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instea
d.
with pd.option_context('mode.use_inf_as_na', True):
In [28]: #barplot
In [29]: df1
In [33]: sns.boxplot(x='sepal_length',data=df1)
plt.show()
In [34]: sns.boxplot(x='species',y='sepal_length',data=df1)
plt.show()
In [38]: plt.figure(figsize=(10,4))
sns.boxplot(x='age',data=df)
plt.show()
In [39]: sns.scatterplot(x='sepal_length',y='sepal_width',data=df1)
plt.show()
In [40]: #plot the histogram for age column in titanic dataset along with distribution plot
In [48]: sns.histplot(x='age',data=df,kde=True)
plt.show()
/Users/satyakumarpalli/anaconda3/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instea
d.
with pd.option_context('mode.use_inf_as_na', True):
In [47]: sns.distplot(df['age'])
plt.show()
/var/folders/nn/9bkkh7612wg2c3gglt0zd9h40000gn/T/ipykernel_19528/2799180019.py:1: UserWarning:
Please adapt your code to use either `displot` (a figure-level function with
similar flexibility) or `histplot` (an axes-level function for histograms).
For a guide to updating your code to use the new functions, please see
https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751
sns.distplot(df['age'])
/Users/satyakumarpalli/anaconda3/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instea
d.
with pd.option_context('mode.use_inf_as_na', True):
In [50]: df2
In [52]: sns.countplot(x='sex',hue='smoker',data=df2)
plt.show()
/Users/satyakumarpalli/anaconda3/lib/python3.10/site-packages/seaborn/categorical.py:641: FutureWarning: The default of observed=False is deprecated and will be changed to True in a future version of pandas. Pass observed=False t
o retain current behavior or observed=True to adopt the future default and silence this warning.
grouped_vals = vals.groupby(grouper)
In [53]: #plot count plot to show num of male and female visitors on each day
sns.countplot(x='sex',hue='day',data=df2)
plt.show()
/Users/satyakumarpalli/anaconda3/lib/python3.10/site-packages/seaborn/categorical.py:641: FutureWarning: The default of observed=False is deprecated and will be changed to True in a future version of pandas. Pass observed=False t
o retain current behavior or observed=True to adopt the future default and silence this warning.
grouped_vals = vals.groupby(grouper)
In [55]: sns.boxplot(x='total_bill',data=df2)
plt.show()
In [58]: sns.boxplot(x='total_bill',y='time',data=df2)
plt.show()
/Users/satyakumarpalli/anaconda3/lib/python3.10/site-packages/seaborn/categorical.py:641: FutureWarning: The default of observed=False is deprecated and will be changed to True in a future version of pandas. Pass observed=False t
o retain current behavior or observed=True to adopt the future default and silence this warning.
grouped_vals = vals.groupby(grouper)
In [61]: sns.histplot(x='total_bill',data=df2,kde=True)
/Users/satyakumarpalli/anaconda3/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instea
d.
with pd.option_context('mode.use_inf_as_na', True):
Out[61]: <Axes: xlabel='total_bill', ylabel='Count'>
In [ ]: