We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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.
df = pd.DataFrame({'A':["1","","3"]}, dtype="object") df.where(df!="", np.nan, inplace=True) df = pd.DataFrame({'A':["1","","3"]}, dtype="string") df.where(df!="", np.nan, inplace=True)
I am getting different results when using the where method with different data type which are "object" and "string".
First, consider the dataframe with "object" and inplace=True options.
inplace=True
Then, I got a result that I expected.
df = pd.DataFrame({'A':["1","","3"]}, dtype="object") df.where(df!="", np.nan, inplace=True) a 0 1 1 NaN 2 3
But, when I changed the dtypes "object" to "string", I got different result as below.
df = pd.DataFrame({'A':["1","","3"]}, dtype="string") df.where(df!="", np.nan, inplace=True) A 0 <NA> 1 2 <NA>
pandas version: 1.3.5 , numpy version: 1.19.5
The text was updated successfully, but these errors were encountered:
I am unable to replicate this on main. I get the behavior that you report for "object" in both cases.
Sorry, something went wrong.
Yeah I believe this was address in 1.4 so closing
code sample for pandas-dev#46366
b3c54f5
No branches or pull requests
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
I am getting different results when using the where method with different data type which are "object" and "string".
Expected Behavior
First, consider the dataframe with "object" and
inplace=True
options.Then, I got a result that I expected.
But, when I changed the dtypes "object" to "string", I got different result as below.
Installed Versions
pandas version: 1.3.5 , numpy version: 1.19.5
The text was updated successfully, but these errors were encountered: