2017-12-19 6 views
0

이 CSV 파일에서 연간 데이터에 대한 간단한 히트 맵을 원합니다. 이 코드를 실행하면온도 히트 맵 : 잘못된 평일/년

, 내 열지도는 당신이 그것을 해결하는 솔루션이 있습니까 시리즈는 좋은 결과

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 

를 반환 잘못된 결과

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

결과를 반환?

+0

예상되는 출력은 무엇입니까? –

+0

답변 해 주셔서 감사합니다. 히트 맵에서 실제 온도를 예상했습니다. 예를 들어, 내 csv 파일에서 2009 년 6 일이 2.6, 0.1, 0.4, -0.6, 0.3, -4.2이고 데이터 프레임 연도가 나에게 (2.6, 0.1, 10.8, 9.9, 15.1, 19.2). 저것은, 왜 열지도를 관찰 할 때, 나는 빨간 색깔을보고 그것이면 안된다. 프랑스에서는 1 월에 19.2 ° C를 기록한 적이 없었습니다 :-) 감사합니다. – noliverte

답변

0

방금 ​​해결책을 찾았습니다 ... 내 csv 파일은 2009-01-01 대신 01/01/2009 ...