Skip to content
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

pandas parsing failed with pandas >1.3.5 #82

Open
robinsedman opened this issue May 16, 2022 · 2 comments
Open

pandas parsing failed with pandas >1.3.5 #82

robinsedman opened this issue May 16, 2022 · 2 comments

Comments

@robinsedman
Copy link

Running the following works with pandas <=1.3.5 but fails with >1.3.5

from qpython import qconnection
with qconnection.QConnection(server, username, port, raw=False) as q:
    query = f"(0b, 1b, 1b, 0b, 1b)"
    data = q(query, pandas=True)

Python 3.9
qpython==2.0.0

@wrkyle
Copy link

wrkyle commented May 25, 2022

I can confirm this. I was trying to get a table with an integer column and I got this error arising from the pandas conversion:

File "C:\Users\kyle_w\AppData\Roaming\Python\Python39\site-packages\qpython-2.0.0-py3.9.egg\qpython\qconnection.py", line 380, in receive
  File "C:\Users\kyle_w\AppData\Roaming\Python\Python39\site-packages\qpython-2.0.0-py3.9.egg\qpython\qreader.py", line 139, in read
  File "C:\Users\kyle_w\AppData\Roaming\Python\Python39\site-packages\qpython-2.0.0-py3.9.egg\qpython\qreader.py", line 338, in _read_general_list
  File "C:\Users\kyle_w\AppData\Roaming\Python\Python39\site-packages\qpython-2.0.0-py3.9.egg\qpython\qreader.py", line 338, in <listcomp>
  File "C:\Users\kyle_w\AppData\Roaming\Python\Python39\site-packages\qpython-2.0.0-py3.9.egg\qpython\qreader.py", line 227, in _read_object
  File "C:\Users\kyle_w\AppData\Roaming\Python\Python39\site-packages\qpython-2.0.0-py3.9.egg\qpython\_pandas.py", line 116, in _read_list
  File "C:\Users\kyle_w\AppData\Roaming\Python\Python39\site-packages\pandas-1.4.2-py3.9-win-amd64.egg\pandas\core\series.py", line 4960, in replace
  File "C:\Users\kyle_w\AppData\Roaming\Python\Python39\site-packages\pandas-1.4.2-py3.9-win-amd64.egg\pandas\core\generic.py", line 6745, in replace
    new_data = self._mgr.replace(
  File "C:\Users\kyle_w\AppData\Roaming\Python\Python39\site-packages\pandas-1.4.2-py3.9-win-amd64.egg\pandas\core\internals\managers.py", line 441, in replace
    return self.apply(
  File "C:\Users\kyle_w\AppData\Roaming\Python\Python39\site-packages\pandas-1.4.2-py3.9-win-amd64.egg\pandas\core\internals\managers.py", line 304, in apply
    applied = getattr(b, f)(**kwargs)
  File "C:\Users\kyle_w\AppData\Roaming\Python\Python39\site-packages\pandas-1.4.2-py3.9-win-amd64.egg\pandas\core\internals\blocks.py", line 683, in replace
    mask = missing.mask_missing(values, to_replace)
  File "C:\Users\kyle_w\AppData\Roaming\Python\Python39\site-packages\pandas-1.4.2-py3.9-win-amd64.egg\pandas\core\missing.py", line 98, in mask_missing
    new_mask = new_mask.to_numpy(dtype=bool, na_value=False)
AttributeError: 'bool' object has no attribute 'to_numpy'

The error disappeared when I removed the integer column from the table I was getting.

EDIT: I rolled back to pandas 1.3.5 using pip install -I pandas==1.3.5 and the error is gone.

@wrkyle
Copy link

wrkyle commented May 30, 2022

To future readers, this project is not being actively maintained. The Fintech Open Source Foundation has forked it and is actively maintaining: https://github.com/finos/qPython.

Install with pip install qpython3. Imports are the same so no code changes required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants