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
Excerpt of line 473-476 from Table.redrawVisible() in core.py in pandastable 0.13.1:
if prec != 0:
if coldata.dtype == 'float64':
coldata = coldata.apply(lambda x: self.setPrecision(x, prec), 1)
coldata = coldata.astype(object).fillna('')
Using pandas 2.2.0, I run into two pandas FutureWarnings, which are repeated hundreds of times when scrolling in the table:
In line 475 I get a warning about the convert_dtype parameter being deprecated in the future. This is caused by the second positional argument to coldata.apply()
In line 476 I get a warning about downcasting object dtype arrays.
I have tried this change to line 475 and line 476
if prec != 0:
if coldata.dtype == 'float64':
coldata = coldata.apply(lambda x: self.setPrecision(x, prec))
coldata = coldata.infer_objects(copy=False).fillna('')
This seems to work and does not cause warnings. At least not in pandas 2.2.0.
I could make a pull request on these two changes, but to be honest, both of them feel iffy, so I am not sure it is the right thing to do.
The change in line 475 seems okay. The default for convert_dtype is True, so removing the argument will not change behaviour. When looking in documentation for pandas 0.17, 1.0.0, 1.5.3, 2.0.0 and 2.1.1, this has apparently always been the case. However, I have a nagging feeling that I have seen warnings in earlier versions for not setting this argument.
The change in line 476 is the change proposed by pandas. But as far as I can see in the pandas documentation, the copy keyword to infer_objects() will also be deprecated in the future. So to remove a FutureWarning, pandas suggests a method which already has a futurewarning in the documentation! And to make it worse, this keyword was apparently new in pandas 2.0.0. The 1.5.3 version of infer_objects() does not take any arguments.
These are the two warnings:
Warning caused by line 475. From class SeriesApply.__init__() in apply.py line 1390-1396 in the pandas 2.2.0 package.
warnings.warn(
"the convert_dtype parameter is deprecated and will be removed in a "
"future version. Do ``ser.astype(object).apply()`` "
"instead if you want ``convert_dtype=False``.",
FutureWarning,
stacklevel=find_stack_level(),
)
Warning caused by line 476. From class Block._maybe_downcast() in blocks.py line 562-571 in the pandas 2.2.0 package.
warnings.warn(
"Downcasting object dtype arrays on .fillna, .ffill, .bfill "
"is deprecated and will change in a future version. "
"Call result.infer_objects(copy=False) instead. "
"To opt-in to the future "
"behavior, set "
"`pd.set_option('future.no_silent_downcasting', True)`",
FutureWarning,
stacklevel=find_stack_level(),
)
The text was updated successfully, but these errors were encountered:
Excerpt of line 473-476 from
Table.redrawVisible()
in core.py in pandastable 0.13.1:Using pandas 2.2.0, I run into two pandas FutureWarnings, which are repeated hundreds of times when scrolling in the table:
convert_dtype
parameter being deprecated in the future. This is caused by the second positional argument tocoldata.apply()
I have tried this change to line 475 and line 476
This seems to work and does not cause warnings. At least not in pandas 2.2.0.
I could make a pull request on these two changes, but to be honest, both of them feel iffy, so I am not sure it is the right thing to do.
The change in line 475 seems okay. The default for
convert_dtype
is True, so removing the argument will not change behaviour. When looking in documentation for pandas 0.17, 1.0.0, 1.5.3, 2.0.0 and 2.1.1, this has apparently always been the case. However, I have a nagging feeling that I have seen warnings in earlier versions for not setting this argument.The change in line 476 is the change proposed by pandas. But as far as I can see in the pandas documentation, the
copy
keyword toinfer_objects()
will also be deprecated in the future. So to remove a FutureWarning, pandas suggests a method which already has a futurewarning in the documentation! And to make it worse, this keyword was apparently new in pandas 2.0.0. The 1.5.3 version ofinfer_objects()
does not take any arguments.These are the two warnings:
Warning caused by line 475. From
class SeriesApply.__init__()
in apply.py line 1390-1396 in the pandas 2.2.0 package.Warning caused by line 476. From
class Block._maybe_downcast()
in blocks.py line 562-571 in the pandas 2.2.0 package.The text was updated successfully, but these errors were encountered: