Skip to content

Commit

Permalink
data.py: rounding input data to 14 significant digits, to work around…
Browse files Browse the repository at this point in the history
… bug in SDV.

  See
  sdv-dev/SDV#1039
  • Loading branch information
TimJohann committed Jan 18, 2023
1 parent cf1156f commit f7893f4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ASyH/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ def read(self, input_file): # generic read method inferring file format from 'm
x = re.compile(".*Excel.*")
c = re.compile(".*CSV.*")
if x.match(filetype):
data = pandas.read_excel(input_file)
# rounding the input to work around
# https://github.com/sdv-dev/SDV/issues/1039
data = pandas.read_excel(input_file).round(decimals=14)
elif c.match(filetype):
data = pandas.read_csv(input_file)
data = pandas.read_csv(input_file).round(decimals=14)
else:
raise DataError("Cannot determine input file type: ")
# the data contains a spurious index column when saved from pandas!
Expand Down

0 comments on commit f7893f4

Please sign in to comment.