/ Python And R Data science skills: 83 Distribution Plots in seaborn Telugu dist plot

Sunday 18 February 2018

83 Distribution Plots in seaborn Telugu dist plot

https://vlrtraining.com/courses/python-data-science-beginner-tutorial 83 Distribution Plots in seaborn telugu(distplot )

Distribution Plots

Let's discuss some plots that allow us to visualize the distribution of a data set. These plots are:

  • distplot
  • jointplot
  • pairplot
  • rugplot
  • kdeplot
In [8]:
import seaborn as sns
%matplotlib inline
In [9]:
tips = sns.load_dataset('tips')
In [11]:
tips.head()
Out[11]:
total_bill tip sex smoker day time size
0 16.99 1.01 Female No Sun Dinner 2
1 10.34 1.66 Male No Sun Dinner 3
2 21.01 3.50 Male No Sun Dinner 3
3 23.68 3.31 Male No Sun Dinner 2
4 24.59 3.61 Female No Sun Dinner 4

distplot

The distplot shows the distribution of a univariate set of observations.

In [15]:
sns.distplot(tips['total_bill'])
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0xc1220b8>
In [14]:
sns.distplot(tips['total_bill'],kde=False)
Out[14]:
<matplotlib.axes._subplots.AxesSubplot at 0xc07a518>
In [6]:
sns.distplot(tips['total_bill'],kde=False,bins=30)
Out[6]:
<matplotlib.axes._subplots.AxesSubplot at 0x8020b70>
In [16]:
sns.distplot(tips['total_bill'],kde=False,bins=130)
Out[16]:
<matplotlib.axes._subplots.AxesSubplot at 0xc18c470>
In [23]:
sns.distplot(tips[["size","totl_bill"]],kde=False)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-23-2f40f0d8520e> in <module>()
----> 1 sns.distplot(tips[["size","totl_bill"]],kde=False)

~\Anaconda3\lib\site-packages\pandas\core\frame.py in __getitem__(self, key)
   2131         if isinstance(key, (Series, np.ndarray, Index, list)):
   2132             # either boolean or fancy integer index
-> 2133             return self._getitem_array(key)
   2134         elif isinstance(key, DataFrame):
   2135             return self._getitem_frame(key)

~\Anaconda3\lib\site-packages\pandas\core\frame.py in _getitem_array(self, key)
   2175             return self._take(indexer, axis=0, convert=False)
   2176         else:
-> 2177             indexer = self.loc._convert_to_indexer(key, axis=1)
   2178             return self._take(indexer, axis=1, convert=True)
   2179 

~\Anaconda3\lib\site-packages\pandas\core\indexing.py in _convert_to_indexer(self, obj, axis, is_setter)
   1267                 if mask.any():
   1268                     raise KeyError('{mask} not in index'
-> 1269                                    .format(mask=objarr[mask]))
   1270 
   1271                 return _values_from_object(indexer)

KeyError: "['totl_bill'] not in index"

No comments:

Post a Comment