These are chat archives for gindeleo/climate

16th
Mar 2016
Gregor
@echna
Mar 16 2016 01:05
Played a while with sns.regplot and sns.tsplot, but couldnt get it to work. According to stackoverflow there is a an overflow bug with using large dataframes with datetime64[ns] dtype. Well, I'n certainly learning -.-
Oliver Gindele
@gindeleo
Mar 16 2016 08:59
ok. what careers fair?
ah ok. shame
Oliver Gindele
@gindeleo
Mar 16 2016 09:06
Ah the ULU spring fair. there aren't really any interesting companies there.
Gregor
@echna
Mar 16 2016 10:03
Yeah, not really. :(
Oliver Gindele
@gindeleo
Mar 16 2016 11:26
are you going anyway?
Oliver Gindele
@gindeleo
Mar 16 2016 11:53
updated climate
Gregor
@echna
Mar 16 2016 16:05

I keep getting this error:

File "C:\Users\Echna\Dropbox\Python\climate\climate-plot_data\inspect_data.py", line 29, in <mo
temp_major_city = pickle.load(handle)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf8 in position 3: ordinal not in range(128)

Event tried running it in python2
Oliver Gindele
@gindeleo
Mar 16 2016 16:19

try 'import sys

reload(sys)
sys.setdefaultencoding('utf8')'

`import sys

reload(sys)
sys.setdefaultencoding('utf8')`

import sys  

reload(sys)  
sys.setdefaultencoding('utf8')
ah thats what I wanted :P
otherwise just load the data and pickle it yourself
Gregor
@echna
Mar 16 2016 16:20
How did you make it so fancy?
Oliver Gindele
@gindeleo
Mar 16 2016 16:20
jut uncomment the relevant line in inspect_data.py
with open('temp_major_city.pkl', 'wb') as handle: pickle.dump(temp_major_city, handle)
next to the chat window is a help button for markdown
Gregor
@echna
Mar 16 2016 16:26
I did try
'''
'''
import sys  

reload(sys)  
sys.setdefaultencoding('utf8')
I think there are some clashes here with python3 -.-
Oliver Gindele
@gindeleo
Mar 16 2016 16:26
did it work?
Gregor
@echna
Mar 16 2016 16:27
i got to change my ipython cmd line to be python 2.7 as well
yes this did work
(un)commenting worked that is
so i m not pickling atm
Oliver Gindele
@gindeleo
Mar 16 2016 16:28
you just need to pickle once, this saves the object as a binary file. maybe python3 changed its default encoding
have a look at the results in climate.py
the r2 of most of the cities is quite low, but looking at how noisy the data is that is not surprising.
and obvs its just a linear fit.
Gregor
@echna
Mar 16 2016 16:31
in climate.py I commented out the pickle and replaced it with pd.read_csv , but i m getting some other error now ARG!!
Oliver Gindele
@gindeleo
Mar 16 2016 16:32
once you have made the pickle you should be able to read it. you can use read_csv but it is much slower.
temp_major_city = pd.read_csv('GlobalLandTemperaturesByMajorCity.csv',parse_dates=[0], infer_datetime_format=True)
that should work
Gregor
@echna
Mar 16 2016 16:33
that s exactly what I used,
the pkl exist, I copied it from github
Let me just get rid of python 3. no point getting hung up on this repeadetly
Oliver Gindele
@gindeleo
Mar 16 2016 16:34
so you still can't read the pkl?
Gregor
@echna
Mar 16 2016 16:35
 46 # #parse data from pickled binary
 47 with  open('temp_major_city.pkl', 'rb') as handle:

---> 48 temp_major_city = pickle.load(handle)
49
50 temp_major_city.set_index(temp_major_city['dt'],inplace=True)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xf8 in position 3: ordinal not in range(128)

the sys stuff doesn't work that easily in python3 got to import importlib etc
Oliver Gindele
@gindeleo
Mar 16 2016 16:37
ok. you can also try to load the csv, dump the pickle and then load just the pkl next time.
Gregor
@echna
Mar 16 2016 16:38
let me just change to python2.7
Gregor
@echna
Mar 16 2016 16:48
getting there. just got to install seaborn for the 3rd time :D
Oliver Gindele
@gindeleo
Mar 16 2016 16:58
haha
Gregor
@echna
Mar 16 2016 17:00
Well it did run once..
def load_eof(self):
raise EOFError
dispatch[''] = load_eof
is my newest error :)
Gregor
@echna
Mar 16 2016 17:06
ok, fixed it somehow.
Oliver Gindele
@gindeleo
Mar 16 2016 17:10
:)