Skip to content

Commit

Permalink
Loads invoice "rate" field as string to suppress scientific notation …
Browse files Browse the repository at this point in the history
…representation

Some of our rates may be have very low values, i.e 0.0000009, which may be displayed
in scientific notation if read as a float by pandas.read_csv()
Specifying the field type as str suppresses this behavior
  • Loading branch information
QuanMPhm committed Jun 6, 2024
1 parent 97fc724 commit 26d9e3c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion process_report/process_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
INSTITUTION_ID_FIELD = "Institution - Specific Code"
SU_HOURS_FIELD = "SU Hours (GBhr or SUhr)"
SU_TYPE_FIELD = "SU Type"
RATE_FIELD = "Rate"
COST_FIELD = "Cost"
CREDIT_FIELD = "Credit"
CREDIT_CODE_FIELD = "Credit Code"
Expand Down Expand Up @@ -327,7 +328,11 @@ def merge_csv(files):
dataframes = []
for file in files:
dataframe = pandas.read_csv(
file, dtype={COST_FIELD: pandas.ArrowDtype(pyarrow.decimal128(12, 2))}
file,
dtype={
COST_FIELD: pandas.ArrowDtype(pyarrow.decimal128(12, 2)),
RATE_FIELD: str,
},
)
dataframes.append(dataframe)

Expand Down

0 comments on commit 26d9e3c

Please sign in to comment.