We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
import pandas as pd import numpy as np df = pd.DataFrame({'col1': ['5', 0, np.NaN, 10, np.NaN], 'col2': [7, np.NaN, np.NaN, 5, 3], 'col3': [12, np.NaN, 1, 2, 0], 'col4': [np.NaN, 1, 1, np.NaN, 18]}) col1 col2 col3 col4 0 5 7.0 12.0 NaN 1 0 NaN NaN 1.0 2 NaN NaN 1.0 1.0 3 10 5.0 2.0 NaN 4 NaN 3.0 0.0 18.0
The following code does not appear to give the correct results. It appears that the axis parameter is ignored.
df.fillna(50,limit=1,axis=1)
col1 col2 col3 col4 0 5.0 7.0 12.0 50.0 1 0.0 50.0 50.0 1.0 2 50.0 NaN 1.0 1.0 3 10.0 5.0 2.0 NaN 4 NaN 3.0 0.0 18.0
However, if just one value in the df is a string value, it appears to work correctly. I have made the first value in the dataframe a string value.
df = pd.DataFrame({'col1': ['5', 0, np.NaN, 10, np.NaN], 'col2': [7, np.NaN, np.NaN, 5, 3], 'col3': [12, np.NaN, 1, 2, 0], 'col4': [np.NaN, 1, 1, np.NaN, 18]})
using the same code as above, it now appears that the axis parameter is not ignored.
col1 col2 col3 col4 0 5 7.0 12.0 50 1 0.0 50.0 NaN 1.0 2 50.0 NaN 1.0 1.0 3 10.0 5.0 2.0 50.0 4 50.0 3.0 0.0 18.0
fillna() should not ignore the axis parameter, and each NaN value should be filled with 50 along axis = 1
fillna()
NaN
50
axis = 1
1.4.3
The text was updated successfully, but these errors were encountered:
ff.garena.com
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Uh oh!
There was an error while loading. Please reload this page.
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
The following code does not appear to give the correct results. It appears that the axis parameter is ignored.
df.fillna(50,limit=1,axis=1)
However, if just one value in the df is a string value, it appears to work correctly. I have made the first value in the dataframe a string value.
df = pd.DataFrame({'col1': ['5', 0, np.NaN, 10, np.NaN], 'col2': [7, np.NaN, np.NaN, 5, 3], 'col3': [12, np.NaN, 1, 2, 0], 'col4': [np.NaN, 1, 1, np.NaN, 18]})
using the same code as above, it now appears that the axis parameter is not ignored.
df.fillna(50,limit=1,axis=1)
Expected Behavior
fillna()
should not ignore the axis parameter, and eachNaN
value should be filled with50
alongaxis = 1
Installed Versions
1.4.3
The text was updated successfully, but these errors were encountered: