Skip to content

HDFStore() create a new file by mode 'a' ,but file name can't be incorrect #16007

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

Closed
imelee opened this issue Apr 15, 2017 · 7 comments
Closed
Labels
Bug Closing Candidate May be closeable, needs more eyeballs IO HDF5 read_hdf, HDFStore Unicode Unicode strings Windows Windows OS

Comments

@imelee
Copy link

imelee commented Apr 15, 2017

Code Sample, a copy-pastable example if possible

with pd.HDFStore(r'e:\网易历史资金.h5') as f:

Problem description

all went on well before update,i got this problem after update python3.52 to python3.6 and conda update --all

Expected Output

the filename should be 网易历史资金.h5 but i got 缃戞槗鍘嗗彶璧勯噾.h5

Output of pd.show_versions()

# Paste the output here pd.show_versions() here INSTALLED VERSIONS ------------------ commit: None python: 3.6.1.final.0 python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 60 Stepping 3, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: None.None

pandas: 0.19.2
nose: 1.3.7
pip: 9.0.1
setuptools: 27.2.0
Cython: 0.25.2
numpy: 1.12.1
scipy: 0.19.0
statsmodels: 0.8.0
xarray: None
IPython: 5.3.0
sphinx: 1.5.4
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: 1.2.0
tables: 3.2.2
numexpr: 2.6.2
matplotlib: 2.0.0
openpyxl: 2.4.1
xlrd: 1.0.0
xlwt: 1.2.0
xlsxwriter: 0.9.6
lxml: 3.7.3
bs4: 4.5.3
html5lib: 0.999
httplib2: None
apiclient: None
sqlalchemy: 1.1.9
pymysql: None
psycopg2: None
jinja2: 2.9.6
boto: 2.46.1
pandas_datareader: None

@jreback
Copy link
Contributor

jreback commented Apr 15, 2017

you would have to show more. This works on 0.19.2.

In [3]: with pd.HDFStore(r'e:\网易历史资金.h5') as f:
   ...:     f.append('df', pd.DataFrame({'A': [1, 2, 3]}))
   ...: 

In [5]:  pd.read_hdf(r'e:\网易历史资金.h5')
Out[5]: 
   A
0  1
1  2
2  3

@imelee
Copy link
Author

imelee commented Apr 16, 2017

@jreback yes, there is no problem to open the file in python environment。go back to the file folder in the operation system, check the file name again ,you will find the problem. I upload a picture to show this problem .
qq 20170416100613

@jreback
Copy link
Contributor

jreback commented Apr 17, 2017

@imelee still not sure what is the problem. can you show a fully copy-pastable example.

@imelee
Copy link
Author

imelee commented Apr 17, 2017

@jreback sorry for my terrible description.I made a notebook file that should be repeat the problem.
after run,i should have got a file in the hard driver e:。the filename should be 网易历史资金_show.h5.
but i got this 缃戞槗鍘嗗彶璧勯噾_show.h5 file .

hmm,i cant upload the .ipynb file ,so i copy them below.

import pandas as pd
a=[['999999', '2017-03-17', 3271.87, 3274.19, 3232.28, 3237.45, -0.96,
26218404249.6, 200583216],
['999999', '2017-03-20', 3241.11, 3251.13, 3228.12, 3250.81, 0.41,
21395175833.6, 170548432],
['999999', '2017-03-21', 3250.25, 3262.22, 3246.7, 3261.61, 0.33,
21912127078.4, 162719312],
['999999', '2017-03-22', 3246.22, 3255.78, 3229.13, 3245.22, -0.5,
24454545408.0, 189731648],
['999999', '2017-03-23', 3245.81, 3262.09, 3221.93, 3248.55, 0.1,
25824668876.8, 193029152],
['999999', '2017-03-24', 3247.35, 3275.21, 3241.12, 3269.45, 0.64,
26709416345.6, 219777920],
['999999', '2017-03-27', 3268.92, 3283.24, 3262.12, 3266.96, -0.08,
24918553395.2, 201852672],
['999999', '2017-03-28', 3265.63, 3265.63, 3246.09, 3252.95, -0.43,
20345248153.6, 161710016],
['999999', '2017-03-29', 3252.87, 3262.1, 3233.28, 3241.31, -0.36,
24537184665.6, 216105568],
['999999', '2017-03-30', 3235.14, 3240.02, 3195.85, 3210.24, -0.96,
26569487155.2, 247135472],
['999999', '2017-03-31', 3206.25, 3226.25, 3205.54, 3222.51, 0.38,
21403615232.0, 196442928],
['999999', '2017-04-05', 3235.66, 3270.65, 3233.24, 3270.31, 1.48,
27320115200.0, 248320208],
['999999', '2017-04-06', 3272.19, 3286.67, 3265.76, 3281.0, 0.33,
26233559449.6, 245288000],
['999999', '2017-04-07', 3280.62, 3295.19, 3275.05, 3286.62, 0.17,
26673831936.0, 236108944],
['999999', '2017-04-10', 3285.46, 3285.46, 3265.01, 3269.39, -0.52,
27941519360.0, 232694624],
['999999', '2017-04-11', 3266.22, 3290.39, 3244.4, 3288.97, 0.6,
32662241280.0, 281281248],
['999999', '2017-04-12', 3283.85, 3284.94, 3262.28, 3273.83, -0.46,
31150551859.2, 269381792],
['999999', '2017-04-13', 3265.22, 3281.14, 3261.49, 3275.96, 0.07,
22328721408.0, 207346880],
['999999', '2017-04-14', 3276.14, 3276.71, 3238.9, 3246.07, -0.91,
22410667622.4, 214508560],
['999999', '2017-04-17', 3229.95, 3229.95, 3199.91, 3222.17, -0.74,
22721468825.6, 212737189]]

b=pd.DataFrame(a,columns=['代码','日期','开盘','最高价','最低价','收盘价','涨幅','成交额','成交量'])
with pd.HDFStore(r'e:\网易历史资金_show.h5') as f:
f.append('gj',b,format='table', append=True,data_columns=True,dtype='float',ignore_index=True)

@jreback
Copy link
Contributor

jreback commented Apr 20, 2017

I suppose this is related to: #15086

3.6 on windows changed the default encoding of file paths (to utf-8).

Can you step thru and see what kind of path is actually being passed to the PyTables open file method.

@jreback jreback added IO HDF5 read_hdf, HDFStore Unicode Unicode strings Windows Windows OS labels Apr 20, 2017
@imelee
Copy link
Author

imelee commented Apr 21, 2017

I think it is impossible job for me after i tried to do trace down the program.but i got some message that may be use for you .first of all: creat a new file in Jupyter Notebook,i got some hint below

executed in 10.0s, finished 21:49:35 2017-04-21

c:\users\imele\documents\tables\hdf5extension.pyx(488)tables.hdf5extension.File._g_new (tables\hdf5extension.c:6017)()

ipdb> n

@mroeschke mroeschke added the Bug label Apr 5, 2020
@jbrockmendel jbrockmendel added the Closing Candidate May be closeable, needs more eyeballs label May 23, 2023
@mroeschke
Copy link
Member

It's not clear what this issue here was so closing for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Closing Candidate May be closeable, needs more eyeballs IO HDF5 read_hdf, HDFStore Unicode Unicode strings Windows Windows OS
Projects
None yet
Development

No branches or pull requests

4 participants