Skip to content

Commit 91deb25

Browse files
code sample for pandas-dev#39338
1 parent b82a8ec commit 91deb25

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

bisect/39338.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import numpy as np
2+
import pandas as pd
3+
4+
print(pd.__version__)
5+
6+
data = df = pd.DataFrame(
7+
{
8+
"a_str": ["A1", "A2", "A3"],
9+
"b_int": ["1,000", "200", "3"],
10+
"c_str": ["C1", "C2", "C3"],
11+
"d_date": ["2021-01-01", "", "2021-03-03"],
12+
}
13+
)
14+
non_string_columns = ["b_int", "d_date"]
15+
16+
df[non_string_columns] = df[non_string_columns].replace(regex={"": np.nan, ",": ""})
17+
18+
print(df)

0 commit comments

Comments
 (0)