Skip to content

Commit

Permalink
Merge pull request #6696 from ales-erjavec/fixes/owcsvimport-pandas-dev
Browse files Browse the repository at this point in the history
[FIX] CSV Import: Add explicit datetime conversion
  • Loading branch information
PrimozGodec committed Jan 15, 2024
2 parents c0a60f2 + 0bed791 commit f5a0f58
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Orange/widgets/data/owcsvimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -1532,11 +1532,6 @@ def expand(ranges):
numbers_format_kwds["thousands"] = opts.group_separator

if numbers_format_kwds:
# float_precision = "round_trip" cannot handle non c-locale decimal and
# thousands sep (https://github.com/pandas-dev/pandas/issues/35365).
# Fallback to 'high'.
numbers_format_kwds["float_precision"] = "high"
else:
numbers_format_kwds["float_precision"] = "round_trip"

with ExitStack() as stack:
Expand All @@ -1559,7 +1554,12 @@ def expand(ranges):
na_values=na_values, keep_default_na=False,
**numbers_format_kwds
)

if parse_dates:
for date_col in parse_dates:
if df.dtypes[date_col] == "object":
df[df.columns[date_col]] = pd.to_datetime(
df.iloc[:, date_col], errors="coerce"
)
if prefix:
df.columns = [f"{prefix}{column}" for column in df.columns]

Expand Down

0 comments on commit f5a0f58

Please sign in to comment.