Skip to content

Commit a9397b5

Browse files
code sample for pandas-dev#46512
1 parent e98c314 commit a9397b5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

bisect/46512.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# BUG: Inconsistency in DataFrame.where between inplace and not inplace with na like value
2+
# for StringArray #46512
3+
4+
import numpy as np
5+
import pandas as pd
6+
7+
print(pd.__version__)
8+
9+
df = pd.DataFrame({"A": ["1", "", "3"]}, dtype="string")
10+
df.where(df != "", np.nan, inplace=True)
11+
print(df)
12+
arr = df["A"]._values
13+
print(arr)
14+
assert arr[1] is pd.NA, type(arr[1])

0 commit comments

Comments
 (0)