前提・実現したいこと
Pythonのライブラリである,seabornのsns.jointplot()を用いて散布図を描く.
データはネットから拾った地価と距離のデータ(price_distance.csv)
発生している問題・エラーメッセージ
ValueError Traceback (most recent call last) <ipython-input-46-e35a51c60fb6> in <module> ----> 1 sns.jointplot(x="kyori",y="nedan",date=df) C:\anaconda\lib\site-packages\seaborn\axisgrid.py in jointplot(x, y, data, kind, stat_func, color, height, ratio, space, dropna, xlim, ylim, joint_kws, marginal_kws, annot_kws, **kwargs) 2282 grid = JointGrid(x, y, data, dropna=dropna, 2283 height=height, ratio=ratio, space=space, -> 2284 xlim=xlim, ylim=ylim) 2285 2286 # Plot the data using the grid C:\anaconda\lib\site-packages\seaborn\axisgrid.py in __init__(self, x, y, data, height, ratio, space, dropna, xlim, ylim, size) 1707 if isinstance(var, string_types): 1708 err = "Could not interpret input '{}'".format(var) -> 1709 raise ValueError(err) 1710 1711 # Find the names of the variables ValueError: Could not interpret input 'kyori'
該当のソースコード
Python
1import numpy as np 2import pandas as pd 3import scipy as sp 4from scipy import stats 5from matplotlib import pyplot as plt 6import seaborn as sns 7sns.set() #seabornのデフォルト設定 8 9import statsmodels.formula.api as smf #統計モデルを推定するライブラリ 10import statsmodels.api as sm 11 12#表示桁数を3桁に 13%precision 3 14#グラフをこのNotebook上に埋め込む 15%matplotlib inline 16 17df=pd.read_csv("price_distance.csv") 18sns.jointplot(x="distance",y="price",data=df)
試したこと
print(df.head())をしたところ,正しくデータが表示されたので,データは読み込めているようです.変数名を変えてみたりしましたがうまくいきません.
print(df.head())の結果↓
nedan kyori
0 43000 57399.98855
1 15800 55177.48373
2 47400 56653.38693
3 43200 55796.13831
4 56200 58419.66631
補足情報(FW/ツールのバージョンなど)
JupyterNotebookを使っています.
以下は,price_distance.csvの銭湯10行です.
nedan kyori
43000 57399.98855
15800 55177.48373
47400 56653.38693
43200 55796.13831
56200 58419.66631
78500 57763.91885
44700 59196.64382
30000 54156.41742
57100 57396.37631
回答2件
あなたの回答
tips
プレビュー