2017-12-19 56 views
0

このCSVファイルからの年間データのヒートマップを簡単に作成したいと考えています。温度ヒートマップ:間違った平日/年

私はこのコードを起動すると、私のヒートマップが間違った結果

from pandas import Series 
from pandas import DataFrame 
from pandas import TimeGrouper 
from matplotlib import pyplot 
series = Series.from_csv('https://easymagic-secret.fr/codes/test5-ko2.csv',sep=';', header=0) 
groups = series.groupby(TimeGrouper('A')) 
years = DataFrame() 
for name, group in groups: 
    years[name.year] = group.values 
years = years.T 
pyplot.matshow(years, fignum = True, aspect='auto',cmap=pyplot.cm.coolwarm) 
pyplot.show() 
years 

enter image description here

シリーズは、良好な結果が

from pandas import Series 
from pandas import DataFrame 
from pandas import TimeGrouper 
from matplotlib import pyplot 
#series = Series.from_csv('dataset/daily-minimum-temperatures.csv', header=0) 
series = Series.from_csv('https://easymagic-secret.fr/codes/test5-ko2.csv',sep=';', header=0) 
series 

Out : 
Date 
2009-01-01  2.6 
2009-02-01  0.1 
2009-03-01  0.4 
2009-04-01 -0.6 
2009-05-01  0.3 
2009-06-01 -4.2 
2009-07-01 -3.4 

あなたはそれを修正するためのソリューションを持っていますか返す結果を返しますか?

+0

期待される出力は何ですか? –

+0

お返事ありがとうございました。ヒートマップで実際の気温が予想されました。たとえば、2009年1月の気温はもっと冷たくなければなりません(つまり、私のCSVファイルで2009年の最初の6日が2.6,0.1、0.4、-0.6、0.3、-4.2)、データフレーム年は私に2.6,12,13、 9.9、15.1、19.2)。その理由は、ヒートマップを観察すると、私は赤い色を見て、それはすべきではありません。残念ながら、1月に19.2°Cのフランスでは決してなかった:-)ありがとう – noliverte

答えて

0

私のcsvファイルは2009-01-01の代わりに01/01/2009 ...

関連する問題