dmnfarrell / pandastable

Table analysis in Tkinter using pandas DataFrames.
Other
636 stars 124 forks source link

Easy: Issue with Thousands Negative Number Formatting in PandasTable Module #240

Closed i-balash closed 8 months ago

i-balash commented 1 year ago

I've encountered an issue in the pandastable module when using the "show" function in tkinter to display a table. When I select the "thousand separator" option, the float values are correctly separated for positive values. However, I've noticed that negative values, which are denoted by a "-" at the beginning, are displayed in scientific notation (and not with the correct thousandseparator).

It would be greatly appreciated if the formatting for negative values could be quickly fixed. This would greatly improve the usability and consistency of the module. Thank you!

i-balash commented 9 months ago

image

If I format the second column to float as the first it will get a -1e-07 display for negative numbers... if I format it to objects it wont have the thousand separator...

i-balash commented 9 months ago

@dmnfarrell is it possible to fix this?

dmnfarrell commented 8 months ago

Long delay but this bug should be fixed. Please check.

i-balash commented 8 months ago

Long delay but this bug should be fixed. Please check.

Thank you! What exactly should I check? There is no branch or PR associated to this ticket, and I am running the actual version of pandastable in pypi (0.13.1).

dmnfarrell commented 8 months ago

You will have to install the package from github as in the readme. I don't use a development branch so whatever changes I add will usually be on the main branch.

i-balash commented 8 months ago

actually it doesn't run at all anymore after updating as described in the readme, when I try to open a table with this exception:

TypeError: infer_objects() got an unexpected keyword argument 'copy' Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\i-balash.pyenv\pyenv-win\versions\3.9.12\lib\tkinter__init.py", line 1892, in call__ return self.func(*args) File "c:\users\i-balash\onedrive\github\sec13f-analysetool\myenv\src\pandastable\pandastable\core.py", line 344, in resized self.redrawVisible() File "c:\users\i-balash\onedrive\github\sec13f-analysetool\myenv\src\pandastable\pandastable\core.py", line 486, in redrawVisible coldata = coldata.infer_objects(copy=False).fillna('')

It is a problem with pandas. but after updating pandas there is another error:

No module named 'pandas.core.indexes.numeric'

Googleing this I found:

https://stackoverflow.com/questions/75953279/modulenotfounderror-no-module-named-pandas-core-indexes-numeric-using-metaflo

It says downgrade pandas to a version < 2

i-balash commented 8 months ago

Yeah it works now!! Thanks a lot! The solution was to update the loading of the pkl from pandas instead of pickle.

image

dmnfarrell commented 8 months ago

so it won't work for you with pandas version >2?

i-balash commented 8 months ago

so it won't work for you with pandas version >2?

it works well with pandas version > 2 with

dfs_dict = pd.read_pickle(dict_file_path)

instead of

dfs_dict = pickle.load(file) (this works only with pandas < 2)

As far I understood pandas > 2 is needed for the comming new release of pandastable, correct?

i-balash commented 8 months ago

Issue can be closed.

dmnfarrell commented 8 months ago

A fairly recent version of pandas should work, but <2 is not recommended. Thanks.