In order to print dataframes nicely using tabulate, so that NaN
and NaT
are printed as empty cells, I've been using this successfully:
print(tabulate(df.astype(object).fillna("")))
Now, this causes the following warning:
FutureWarning: Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead.
I don't know what I should do instead now. I certainly don't see how infer_objects(copy=False)
would help as the whole point here is indeed to force converting everything to a string representation and filling in missing values with empty strings.
pd.set_option('future.no_silent_downcasting', True)
``` I also feel that suppressing the warning is not the correct approach. Were you able to resolve the problem? Is this an issue we need to raise with pandas developers? – Kristikristian