'Python Seaborn and Pandas Data Presentatation in Graphical Form

I was trying ML in python. During the process I had to come across seaborn.pairplot or other plot function and pandas.plot functions. To be simple I'm putting the scope of this question within seaborn only as the same solution is likely to work for pandas also.

I was trying the very basic codes presented in seaborn website.

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


tips = sns.load_dataset("tips")
g = sns.relplot(data=tips, x="total_bill", y="tip")
g.ax.axline(xy1=(10, 2), slope=.2, color="b", dashes=(5, 2))

The datasets have been cloned from seaborn Github repository. Still the moment the execution comes to sns.*plot() functions it gives a 'NoneType' object is not callable Error.

The seaborn dataset from Git repository has quite a few csv datesets.A bove was about tips.csv. sns.load_dataset("tips") can load the dataset tips.csv from current directory. Whereas for another dataset penguins residing in the same directory sns.load_dataset("penguins") fails!

After os is imported by import os within penguins.py, print(os.getcwd()) gives a different result even though both penguins.csv and tips.csv are in the same folder and also penguins.py and tips.py are in the same folder but different from dataset folder as blow.

'D:\Protege\Documents\Seaborn\~.csv' #where all datasets are 
'D:\Protege\Documents\Seaborn\process\~.py' #where all ~.py files are

For tips os.getcwd rightly gives the first directory. Whereas in penguins.py the same function gives the second result.

If I put sns.load_dataset('D:\Protege\Documents\Seaborn\Penguins.csv') it says penguins is not one of the datasets.

Let's discuss for tips and 'NoneType' object is not callable Error first.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source