I am trying to utilize Seaborn to create a visualization.
Here is what I have thus far:
import os.path
directory = os.path.dirname(os.path.abspath(__file__))
import pandas as pd
import seaborn as sns
sns.set(style="whitegrid", color_codes=True)
tel = pd.read_csv('nyc.csv')
nyctel = sns.load_dataset(tel)
sns.stripplot(x="installation_id", y="mounting", hue="mounting", data=nyctel)
The official documentation for load_dataset is completely useless, so I found that someone had already asked a question about how it works here: https://stackoverflow.com/a/30337377/6110631
I followed the format listed in the answer and imported pandas so I could use a local file (saved in the same folder). When I run the program however, I get
IOError: File nyc.csv does not exist
If I use an absolute path I get
IOError: ('http protocol error', 0, 'got a bad status line', None)
It seems the problem is with this line:
nyctel = sns.load_dataset(tel)
because if I omit this line and the line beneath it and add print tel
beneath the pd.read_csv line then the program works and it prints out the contents of the file. Somehow load_dataset
is not letting me use that file though!
I am using the exact same code as in the answer linked above. Why would this not work for this local file?