You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When editing a column of a complex type (complex64, complex128 and the built in complex), the DataFrame Editor raises a TypeError when attempting to confirm/commit any edits to any of the values in the column. This seems to occur regardless of what value is entered, whether the original (displayed as “###j), a tuple, a single integer, etc. However, it works just fine for arrays, so perhaps that logic can just be ported over?
What steps will reproduce the problem?
Create a DataFrame with at least one column being of a complex type. E.g.
import pandas as pd
import numpy as np
df = pd.DataFrame([0, 0, 0], dtype=np.complex128)
Open the DataFrame in the Data Frame editor
Doubleclick one of the complex values to edit and click away again to commit
What is the expected output? What do you see instead?
Expected: Either a functioning ability to input a complex value as works perfectly well for arrays, or at the very least a "The type of the cell is not a supported type" warning or just setting the cell to read only.
Instead, an error dialog with :
File "C:\Users\christopher.gerlach\Anaconda3\lib\site-packages\spyder\widgets\variableexplorer\dataframeeditor.py", line 368, in setData
self.df.iloc[row, column-1] = current_value.__class__(val)
TypeError: must be real number, not str
Proposed solution
Port whatever logic is currently used for ArrayEditor to handle working with complex types over to the DataFrame Editor, if that's practicable. If not, and there's no other straightforward way to fix this, just catch the exception and pop up a "The type of the cell is not a supported type" warning dialog on attempting to edit instead for the time being, or disable editing completely if possible (so a double click action is just ignored).
Description
When editing a column of a complex type (
complex64
,complex128
and the built incomplex
), the DataFrame Editor raises aTypeError
when attempting to confirm/commit any edits to any of the values in the column. This seems to occur regardless of what value is entered, whether the original (displayed as “###j), a tuple, a single integer, etc. However, it works just fine for arrays, so perhaps that logic can just be ported over?What steps will reproduce the problem?
What is the expected output? What do you see instead?
Expected: Either a functioning ability to input a complex value as works perfectly well for arrays, or at the very least a "The type of the cell is not a supported type" warning or just setting the cell to read only.
Instead, an error dialog with :
Proposed solution
Port whatever logic is currently used for ArrayEditor to handle working with complex types over to the DataFrame Editor, if that's practicable. If not, and there's no other straightforward way to fix this, just catch the exception and pop up a "The type of the cell is not a supported type" warning dialog on attempting to edit instead for the time being, or disable editing completely if possible (so a double click action is just ignored).
Version and main components
Dependencies
The text was updated successfully, but these errors were encountered: