Pandas: ValueError :이 λ°°μ—΄μ˜ WRITEABLE ν”Œλž˜κ·Έλ₯Ό True둜 μ„€μ •ν•  수 μ—†μŠ΅λ‹ˆλ‹€.

에 λ§Œλ“  2019λ…„ 01μ›” 19일  Β·  16μ½”λ©˜νŠΈ  Β·  좜처: pandas-dev/pandas

이 λ¬Έμ œκ°€ ν•΄κ²°λ˜λ©΄ https://github.com/pandas-dev/pandas/pull/25517 μ—μ„œ xfail λ°μ½”λ ˆμ΄ν„°λ₯Ό 되돌렀 μ•Όν•©λ‹ˆλ‹€.

μ½”λ“œ μƒ˜ν”Œ, κ°€λŠ₯ν•œ 경우 λ³΅μ‚¬ν•˜μ—¬ λΆ™μ—¬ 넣을 μˆ˜μžˆλŠ” 예제

κ°‘μžκΈ°μ΄ 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.

# Your code here
 input_df = pd.read_hdf(path_or_buf='x.hdf5',key='/x',mode='r')

문제 μ„€λͺ…

μ—­ 좔적 :
` Traceback (most recent call last): File "...", line 115, in <module> input_df = pd.read_hdf(path_or_buf='x.hdf5',key='/x',mode='r') File "/usr/local/lib/python3.6/dist-packages/pandas/io/pytables.py", line 394, in read_hdf return store.select(key, auto_close=auto_close, **kwargs) File "/usr/local/lib/python3.6/dist-packages/pandas/io/pytables.py", line 741, in select return it.get_result() File "/usr/local/lib/python3.6/dist-packages/pandas/io/pytables.py", line 1483, in get_result results = self.func(self.start, self.stop, where) File "/usr/local/lib/python3.6/dist-packages/pandas/io/pytables.py", line 734, in func columns=columns) File "/usr/local/lib/python3.6/dist-packages/pandas/io/pytables.py", line 2937, in read start=_start, stop=_stop) File "/usr/local/lib/python3.6/dist-packages/pandas/io/pytables.py", line 2489, in read_array ret = node[0][start:stop] File "/usr/local/lib/python3.6/dist-packages/tables/vlarray.py", line 681, in __getitem__ return self.read(start, stop, step)[0] File "/usr/local/lib/python3.6/dist-packages/tables/vlarray.py", line 821, in read listarr = self._read_array(start, stop, step) File "tables/hdf5extension.pyx", line 2155, in tables.hdf5extension.VLArray._read_array ValueError: cannot set WRITEABLE flag to True of this array

Bug Dependencies IO HDF5

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

numpy = 1.16.0을 μ‚¬μš©ν•  λ•Œ numpy = 1.15.4 문제λ₯Ό λ‹€μš΄ κ·Έλ ˆμ΄λ“œν•˜λ©΄μ΄ 였λ₯˜κ°€ λ°œμƒν•©λ‹ˆλ‹€.

λͺ¨λ“  16 λŒ“κΈ€

@ macd2 : μ‹ κ³  ν•΄ μ£Όμ…”μ„œ κ°μ‚¬ν•©λ‹ˆλ‹€! λͺ‡ 가지 :

  • λ¬Έμ œμ—μ„œ pandas.show_versions 의 ν™˜κ²½ 정보λ₯Ό 제곡 ν•  수 μžˆμŠ΅λ‹ˆκΉŒ?
  • κ°€λŠ₯ν•˜λ‹€λ©΄μ΄ 였λ₯˜λ₯Ό μœ λ°œν•˜λŠ” νŒŒμΌμ„ κ³΅μœ ν•΄ μ£Όμ‹œκ² μŠ΅λ‹ˆκΉŒ?

κ°‘μžκΈ°μ΄ 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.

  • pandas 의 이전 λ²„μ „μ—μ„œ μž‘λ™ν•˜λŠ” 것 κ°™μŠ΅λ‹ˆλ‹€. 이 μ½”λ“œκ°€ μ–Έμ œ λ§ˆμ§€λ§‰μœΌλ‘œ μž‘λ™ ν–ˆμŠ΅λ‹ˆκΉŒ? ν˜„μž¬ μ‚¬μš©μ€‘μΈ 버전은 λ¬΄μ—‡μž…λ‹ˆκΉŒ (첫 번째 질문과 κ΄€λ ¨)?

cc @jreback

numpy = 1.16.0을 μ‚¬μš©ν•  λ•Œ numpy = 1.15.4 문제λ₯Ό λ‹€μš΄ κ·Έλ ˆμ΄λ“œν•˜λ©΄μ΄ 였λ₯˜κ°€ λ°œμƒν•©λ‹ˆλ‹€.

@gfyoung μ—¬κΈ° 버전이 μžˆμŠ΅λ‹ˆλ‹€.
```pandas.show_versions
'쒅속성':
{ 'pandas': '0.23.4', 'pytest': '3.4.0', 'pip': '18 .1 ','setuptools ': '40 .6.3', 'Cython': '0.29.3', ' numpy ':'1.16.0 ','scipy ':'1.2.0 ','pyarrow ': μ—†μŒ,'xarray ': μ—†μŒ,'IPython ':'6.5.0 ','sphinx ': μ—†μŒ,'patsy ' : '0.5.0', 'dateutil': '2.7.5', 'pytz': '2018.7', 'blosc': μ—†μŒ, 'bottleneck': '1.2.1', 'tables': '3.4.4' , 'numexpr': '2.6.8', 'feather': μ—†μŒ, 'matplotlib': '3.0.2', 'openpyxl': '2.5.12', 'xlrd': '1.1.0', 'xlwt' : '1.3.0', 'xlsxwriter': '0.7.3', 'lxml': '4.1.1', 'bs4': '4.4.1', 'html5lib': '1.0b8', 'sqlalchemy': '1.2.15', 'pymysql': '0.9.2', 'psycopg2': '2.7.6.1 (dt dec pq3 ext lo64)', 'jinja2': '2.10', 's3fs': μ—†μŒ, 'fastparquet' : μ—†μŒ, 'pandas_gbq': μ—†μŒ, 'pandas_datareader': '0.7.0'}

```

λΆˆν–‰νžˆλ„ νŒŒμΌμ„ 곡유 ν•  μˆ˜λŠ” μ—†μ§€λ§Œ @vvvlc κ°€ git에 λŒ€ν•œ λ‹€λ₯Έ λ¬Έμ œκ°€ μžˆλ‹€κ³  λ§ν–ˆλ“―μ΄ λ¬Έμ œλŠ” μ‹€μ œλ‘œ numpyμ—μ„œ

https://github.com/nipy/nibabel/issues/697

PS: just downgraded to numpy=1.15.4 and indeed it resolves the issue

κ·Έλ™μ•ˆ νŒ¬λ”κ°€ ν•  μˆ˜μžˆλŠ” 일이 μžˆλ‚˜μš”? μ•„λ‹ˆλ©΄ κ·Έλƒ₯ λ‹€μŒμ„ κΈ°λ‹€λ €
pytables μΆœμ‹œ?

2019 λ…„ 1 μ›” 21 일 μ›”μš”μΌ μ˜€μ „ 5:34 macd2 [email protected] μž‘μ„± :

@gfyoung https://github.com/gfyoung μ—¬κΈ° 버전이 μžˆμŠ΅λ‹ˆλ‹€.

'쒅속성':
{ 'pandas': '0.23.4', 'pytest': '3.4.0', 'pip': '18 .1 ','setuptools ': '40 .6.3', 'Cython': '0.29.3', ' numpy ':'1.16.0 ','scipy ':'1.2.0 ','pyarrow ': μ—†μŒ,'xarray ': μ—†μŒ,'IPython ':'6.5.0 ','sphinx ': μ—†μŒ,'patsy ' : '0.5.0', 'dateutil': '2.7.5', 'pytz': '2018.7', 'blosc': μ—†μŒ, 'bottleneck': '1.2.1', 'tables': '3.4.4' , 'numexpr': '2.6.8', 'feather': μ—†μŒ, 'matplotlib': '3.0.2', 'openpyxl': '2.5.12', 'xlrd': '1.1.0', 'xlwt' : '1.3.0', 'xlsxwriter': '0.7.3', 'lxml': '4.1.1', 'bs4': '4.4.1', 'html5lib': '1.0b8', 'sqlalchemy': '1.2.15', 'pymysql': '0.9.2', 'psycopg2': '2.7.6.1 (dt dec pq3 ext lo64)', 'jinja2': '2.10', 's3fs': μ—†μŒ, 'fastparquet' : μ—†μŒ, 'pandas_gbq': μ—†μŒ, 'pandas_datareader': '0.7.0'}

μ•ˆνƒ€κΉκ²Œλ„ νŒŒμΌμ„ 곡유 ν•  수 μ—†μ§€λ§Œ λ¬Έμ œκ°€ μ‹€μ œλ‘œ λ°œμƒν•œλ‹€κ³  μƒκ°ν•©λ‹ˆλ‹€.
@vvvlc https://github.com/vvvlc 둜 numpyμ—μ„œ 여기에 λ‹€λ₯Έ 것이 μžˆλ‹€κ³  λ§ν–ˆμŠ΅λ‹ˆλ‹€.
κ·Έλ“€μ˜ μžμ‹μ— λŒ€ν•œ 문제 :

nipy / nibabel # 697 https://github.com/nipy/nibabel/issues/697

β€”
이 μŠ€λ ˆλ“œλ₯Ό κ΅¬λ…ν–ˆκΈ° λ•Œλ¬Έμ—μ΄ λ©”μ‹œμ§€κ°€ μ „μ†‘λ˜μ—ˆμŠ΅λ‹ˆλ‹€.
이 이메일에 직접 λ‹΅μž₯ν•˜κ³  GitHubμ—μ„œ ν™•μΈν•˜μ„Έμš”.
https://github.com/pandas-dev/pandas/issues/24839#issuecomment-456043488 ,
λ˜λŠ” μŠ€λ ˆλ“œ μŒμ†Œκ±°
https://github.com/notifications/unsubscribe-auth/ABQHIqiIyuE-lmMlN2Ep-4htyMrTBdefks5vFaWqgaJpZM4aJQqs
.

μ €μ—κ²Œ pip install numpy==1.15.4 도이 문제λ₯Ό ν•΄κ²°ν•©λ‹ˆλ‹€.

@TomAugspurger 이 λ¬Έμ œλŠ” Googleμ—μ„œ 맨 μœ„μ— 보이 λ―€λ‘œ μ—…μŠ€νŠΈλ¦Ό μˆ˜μ •μ„ κΈ°λ‹€λ¦¬λŠ” κ²ƒμœΌλ‘œ μΆ©λΆ„ν•  수 μžˆμŠ΅λ‹ˆλ‹€. 당신이 λ¬Όμ–΄λ³Ό 정말 λŒ€λ‹¨ν•©λ‹ˆλ‹€ :)

pip3 install numpy==1.15.4 도 ν•΄κ²°ν–ˆμŠ΅λ‹ˆλ‹€ ..

κ·ΈλŸ¬λ‚˜ numpyλ₯Ό λ‹€μš΄ κ·Έλ ˆμ΄λ“œν–ˆμ„ λ•Œ ImportError: No module named 'numpy.core._multiarray_umath' 였λ₯˜κ°€ 계속 λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€. λ§ˆμ§€λ§‰μœΌλ‘œ numpy 1.16이 μ„€μΉ˜λœ .h5 νŒŒμΌμ„ μ €μž₯ν•˜κ³  λ‹€μš΄ κ·Έλ ˆμ΄λ“œ 된 numpy둜 λ‹€μ‹œ 열리지 μ•ŠκΈ° λ•Œλ¬Έμ— λ°œμƒν•œλ‹€λŠ” 것을 μ•Œκ²Œλ˜μ—ˆμŠ΅λ‹ˆλ‹€ ...

였λ₯˜λ₯Ό ν”Όν•  수 μžˆμŠ΅λ‹ˆλ‹€.
ValueError: cannot set WRITEABLE flag to True of this array
Pandas둜 데이터λ₯Ό μ €μž₯ν•  λ•Œ format='table' 을 HDFStore.append λ˜λŠ” HDFStore.put 에 μ „λ‹¬ν•©λ‹ˆλ‹€.

이것은 pandas 0.24 및 numpy 1.16+둜 ν…ŒμŠ€νŠΈν•˜μ—¬ 문제λ₯Ό ν•΄κ²°ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

@ dev72
κ·Έλž˜λ„ 이미 μ‘΄μž¬ν•˜λŠ” 였래된 HDF νŒŒμΌμ€ μ–΄λ–»μŠ΅λ‹ˆκΉŒ?

였래된 hdf νŒŒμΌμ„ μ½λŠ” κ°€μž₯ 쒋은 방법은 pandas + numpy 버전을 λ‹€μš΄ κ·Έλ ˆμ΄λ“œν•˜κ³  λͺ¨λ“  데이터λ₯Ό 읽고 format='table' 둜 μƒˆ hdf μ €μž₯μ†Œμ— μ“°λŠ” κ²ƒμž…λ‹ˆλ‹€.
그런 λ‹€μŒ μ΅œμ‹  numpy 및 pandas λ²„μ „μ—μ„œ μž‘λ™ν•©λ‹ˆλ‹€.

@ dev72 예 λ§žμŠ΅λ‹ˆλ‹€ 같은 μ§€μ μ—μ„œ im, κ·ΈλŸ¬λ‚˜ 이것이 μ œλŒ€λ‘œ μˆ˜μ • 될 λ•ŒκΉŒμ§€ λ‹€μš΄ κ·Έλ ˆμ΄λ“œλ₯Ό κ³ μˆ˜ν•˜λŠ” 것보닀

예, Googleμ—μ„œλ„ λ§ˆμ°¬κ°€μ§€μž…λ‹ˆλ‹€. @ macd2 문제λ₯Ό

λ”°λΌμ„œ numpy 및 PyTables 제좜 된 λͺ‡ 가지 문제λ₯Ό μ‚΄νŽ΄λ³Έ ν›„ PyTables λ§ˆμŠ€ν„°μ—μ„œ μˆ˜μ •λ˜μ—ˆμ§€λ§Œ 아직 λ¦΄λ¦¬μŠ€μ—μ„œλŠ” ν•΄κ²°λ˜μ§€ μ•Šμ•˜ 음 을 μ œμ•ˆν•©λ‹ˆλ‹€.

https://github.com/PyTables/PyTables/issues/719#issuecomment -455612656

PyTables master w / numpy >= 0.16 μ‚¬μš©μ„ μ‹œλ„ν•œ μ‚¬λžŒμ΄ μžˆμŠ΅λ‹ˆκΉŒ?

λ‚˜λŠ” 이것을 μ‚¬μš©ν•˜μ—¬ μž‘λ™ν•˜κ²Œν–ˆμŠ΅λ‹ˆλ‹€.

HDF5_DIR={HDF5_PATH} pip install -e git+https://github.com/PyTables/PyTables@492ee2f#egg=tables
pip install numpy==1.16.0

cython 및 hdf5κ°€ μ„€μΉ˜λ˜μ–΄ μžˆλŠ”μ§€ ν™•μΈν•˜μ‹­μ‹œμ˜€.

μ–΄λ–€ λ²„μ „μ˜ pytables와 numpyκ°€ 이것을 μž¬ν˜„ν•©λ‹ˆκΉŒ? 데이터와 κ΄€λ ¨λœ κ²ƒμž…λ‹ˆκΉŒ?

와

pandas: 0.24.1
numpy: 1.16.2
tables: 3.4.4

이것은 μ˜¬λ¦¬μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

In [8]: df = pd.DataFrame({"A": [1, 2]})

In [9]: df.to_hdf('x.hdf5', key='x')

In [10]: pd.read_hdf('x.hdf5', 'x', mode='r')
Out[10]:
   A
0  1
1  2

참고둜, pytables 3.5.0 및 3.5.1은 pytables μΈ‘μ—μ„œ μˆ˜μ • ν•œ PyPI에 μžˆμŠ΅λ‹ˆλ‹€.

pytables 3.5.1둜 μ—…κ·Έλ ˆμ΄λ“œν•˜λ©΄ numpy 1.16.2μ—μ„œλ„ λ¬Έμ œκ°€ ν•΄κ²°λ©λ‹ˆλ‹€.

tf 2.0.0을 μ²˜λ¦¬ν•˜λ €λ©΄ numpy (적어도) 1.16.0이 ν•„μš”ν•©λ‹ˆλ‹€. numpyλ₯Ό 이전 λ²„μ „μœΌλ‘œ λ‹€μš΄ κ·Έλ ˆμ΄λ“œν•˜λ©΄ tf 2.0.0μ—μ„œ μž‘λ™ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰