InNoobWeTrust
commited on
Commit
·
b69e760
1
Parent(s):
2864c97
fix: handle commas as thousands separator
Browse files
df.py
CHANGED
@@ -18,7 +18,9 @@ def clean_etf_data(df):
|
|
18 |
|
19 |
# Format outflow to negative value
|
20 |
df = df.drop(columns="Date")
|
21 |
-
df.replace(to_replace=r"\(([0-9
|
|
|
|
|
22 |
|
23 |
# Replace '-' with 0
|
24 |
df.replace("-", 0, inplace=True)
|
|
|
18 |
|
19 |
# Format outflow to negative value
|
20 |
df = df.drop(columns="Date")
|
21 |
+
df.replace(to_replace=r"\(([0-9.,]+)\)", value=r"-\1", regex=True, inplace=True)
|
22 |
+
# Remove thousands separator
|
23 |
+
df.replace(to_replace=r",", value=r"", regex=True, inplace=True)
|
24 |
|
25 |
# Replace '-' with 0
|
26 |
df.replace("-", 0, inplace=True)
|