我试图利用Seaborn来创造一个形象。在
以下是我目前所掌握的情况:
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)
load\u数据集的官方文档完全没有用,所以我发现有人已经问过它在这里是如何工作的:https://stackoverflow.com/a/30337377/6110631
我按照答案中列出的格式导入pandas,这样我就可以使用本地文件(保存在同一个文件夹中)。但是,当我运行程序时
^{pr2}$如果我用绝对路径
IOError: ('http protocol error', 0, 'got a bad status line', None)
问题似乎出在这条线上:
nyctel = sns.load_dataset(tel)
因为如果我省略这一行和它下面的那一行,并在下面添加print tel
pd.read_csv文件然后程序工作并打印出文件的内容。不知何故load_dataset
不允许我使用该文件!在
我使用的代码与上面链接的答案完全相同。为什么这对本地文件无效?在
我是通过手机发布的,所以没有经过测试:
相关问题 更多 >
编程相关推荐