-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: round-trip of tz in an index using fixed-format for HDF5 #8165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
pls show |
Great (not), while generating the output both datafiles fail to open in Py3: ############### Py2 ####################
INSTALLED VERSIONScommit: None pandas: 0.13.1
No errors. class 'pandas.core.frame.DataFrame'> ############### Py3 #################### pd.show_versions() INSTALLED VERSIONScommit: None pandas: 0.14.1 data = pd.read_hdf('datafile-py2.h5', 'received') File "", line 1, in File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 330, in read_hdf File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 322, in File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 669, in select File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 1335, in get_values File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 658, in func File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 2658, in read File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 2257, in read_index File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 2385, in read_index_node File "C:\Anaconda3\lib\site-packages\pandas\core\index.py", line 125, in new File "C:\Anaconda3\lib\site-packages\pandas\tseries\index.py", line 301, in new File "tslib.pyx", line 2165, in pandas.tslib.tz_localize_to_utc (pandas\tslib.c:33574) File "tslib.pyx", line 2082, in pandas.tslib._get_deltas (pandas\tslib.c:32187) File "tslib.pyx", line 872, in pandas.tslib._get_utcoffset (pandas\tslib.c:16036) AttributeError: 'numpy.bytes_' object has no attribute 'utcoffset' data_py3 = pd.read_hdf('datafile-py3.h5', 'received') File "", line 1, in File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 330, in read_hdf File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 322, in File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 669, in select File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 1335, in get_values File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 658, in func File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 2658, in read File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 2257, in read_index File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 2385, in read_index_node File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 2182, in f File "C:\Anaconda3\lib\site-packages\pandas\tseries\index.py", line 480, in _simple_new File "C:\Anaconda3\lib\site-packages\pandas\tseries\tools.py", line 60, in _maybe_get_tz File "tslib.pyx", line 1060, in pandas.tslib.maybe_get_tz (pandas\tslib.c:18462) File "tslib.pyx", line 1073, in pandas.tslib.maybe_get_tz (pandas\tslib.c:18380) File "C:\Anaconda3\lib\site-packages\pytz__init__.py", line 171, in timezone File "C:\Anaconda3\lib\site-packages\pytz__init__.py", line 187, in _unmunge_zone TypeError: expected bytes, bytearray or buffer compatible object Generating function contains the following (munging row oriented csv file):First, I extract a time list of strings from the csv readlines and a 2D rawdata list of list of numbers (as str)
|
This is related to : #7777 and might be fixed there can you provide a public-accessable file and I will try this on master. |
Generated py2 and py3 versions with this script: datafilename_py2 = 'datafile-py2.h5' drange = pd.date_range('2014-09-01', '2014-09-02', freq='1h') The files can be found here: https://www.mediafire.com/?cad8fn21r4eukf0,1njl9sz9s3d7d5g,5y8nkrbklfd0d3j Using new consoles each time, the Py3 fails to open the Py2 datafile but now again successfully opens the Py3 version. The Py2 console opens both files successfully. Could this be related to the format of the time zone with the / in it? Also:
|
This might be a bug in saving it using 'fixed' format. This should work properly using |
I have confirmed that hdf5 files created in Python 2 with format='table' open successfully in Python 3. Do you think it is possible to adapt the read_hdf() to cope with the existing hdf5 files? I have over 900 hdf5 files, not all with tz index but still enough for me to reconsider the big Py2->Py3 jump. |
not sure when this will get looked at |
I have taken a look, played around in the debugger, but I got lost in the tseries index.py DatetimeIndex new method. |
closing in favor of #11411 |
xref #9270
With Python 2.7.6, pandas 0.13.1 and numpy 1.8.1, pytables 3.1.1, both 32 and 64bit (Python x,y and WinPython), I can load my hdf5 file.
With Python 3.4.1 64bit, pandas 0.14.1, numpy 1.8.2, pytables 3.1.1 (Anaconda3 2.0.1) I get the following error:
Traceback (most recent call last):
File "", line 1, in
test = pd.read_hdf('datafile.h5', 'data')
File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 330, in read_hdf
return f(store, True)
File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 322, in
key, auto_close=auto_close, **kwargs)
File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 669, in select
auto_close=auto_close).get_values()
File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 1335, in get_values
results = self.func(self.start, self.stop)
File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 658, in func
columns=columns, **kwargs)
File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 2658, in read
ax = self.read_index('axis%d' % i)
File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 2257, in read_index
_, index = self.read_index_node(getattr(self.group, key))
File "C:\Anaconda3\lib\site-packages\pandas\io\pytables.py", line 2385, in read_index_node
_unconvert_index(data, kind, encoding=self.encoding), **kwargs)
File "C:\Anaconda3\lib\site-packages\pandas\core\index.py", line 125, in new
result = DatetimeIndex(data, copy=copy, name=name, **kwargs)
File "C:\Anaconda3\lib\site-packages\pandas\tseries\index.py", line 301, in new
infer_dst=infer_dst)
File "tslib.pyx", line 2165, in pandas.tslib.tz_localize_to_utc (pandas\tslib.c:33574)
File "tslib.pyx", line 2082, in pandas.tslib._get_deltas (pandas\tslib.c:32187)
File "tslib.pyx", line 872, in pandas.tslib._get_utcoffset (pandas\tslib.c:16036)
AttributeError: 'numpy.bytes_' object has no attribute 'utcoffset'
The index in question is:
class 'pandas.tseries.index.DatetimeIndex'
[2013-04-03 00:00:00+02:00, ..., 2013-04-04 00:00:00+02:00]
Length: 8641, Freq: 10S, Timezone: Europe/Amsterdam
The text was updated successfully, but these errors were encountered: