Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
9d1b70c
1
Parent(s):
8d1ba7d
Clean up number parsing from csv
Browse files- pysr/sr.py +4 -3
pysr/sr.py
CHANGED
@@ -2020,13 +2020,14 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
2020 |
regexp_im = re.compile(r"\b(\d+\.\d+)im\b")
|
2021 |
regexp_im_sci = re.compile(r"\b(\d+\.\d+)[eEfF]([+-]?\d+)im\b")
|
2022 |
regexp_sci = re.compile(r"\b(\d+\.\d+)[eEfF]([+-]?\d+)\b")
|
|
|
|
|
|
|
2023 |
|
2024 |
def _replace_im(df):
|
2025 |
-
df["equation"] = df["equation"].apply(lambda x: regexp_im.sub(r"\1j", x))
|
2026 |
df["equation"] = df["equation"].apply(
|
2027 |
-
lambda x:
|
2028 |
)
|
2029 |
-
df["equation"] = df["equation"].apply(lambda x: regexp_sci.sub(r"\1e\2", x))
|
2030 |
|
2031 |
try:
|
2032 |
if self.nout_ > 1:
|
|
|
2020 |
regexp_im = re.compile(r"\b(\d+\.\d+)im\b")
|
2021 |
regexp_im_sci = re.compile(r"\b(\d+\.\d+)[eEfF]([+-]?\d+)im\b")
|
2022 |
regexp_sci = re.compile(r"\b(\d+\.\d+)[eEfF]([+-]?\d+)\b")
|
2023 |
+
apply_regexp_im = lambda x: regexp_im.sub(r"\1j", x)
|
2024 |
+
apply_regexp_im_sci = lambda x: regexp_im_sci.sub(r"\1e\2j", x)
|
2025 |
+
apply_regexp_sci = lambda x: regexp_sci.sub(r"\1e\2", x)
|
2026 |
|
2027 |
def _replace_im(df):
|
|
|
2028 |
df["equation"] = df["equation"].apply(
|
2029 |
+
lambda x: apply_regexp_sci(apply_regexp_im_sci(apply_regexp_im(x)))
|
2030 |
)
|
|
|
2031 |
|
2032 |
try:
|
2033 |
if self.nout_ > 1:
|