Skip to content

Commit

Permalink
define registry dtypes
Browse files Browse the repository at this point in the history
  • Loading branch information
JessyBarrette committed Nov 16, 2023
1 parent f0daed7 commit 63d79d7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions ocean_data_parser/batch/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
).set_index("source")


REGSITRY_DTYPE = {
"source": str,
"mtime": float,
"hash": str,
"error_message": str,
"output_path": str,
}


class FileConversionRegistry:
def __init__(
self,
Expand All @@ -42,9 +51,9 @@ def load(self, overwrite=False):
elif self.path is None or not self.path.exists():
self.data = pd.DataFrame()
elif self.path.suffix == ".csv":
self.data = pd.read_csv(self.path)
self.data = pd.read_csv(self.path, dtype=REGSITRY_DTYPE)
elif self.path.suffix == ".parquet":
self.data = pd.read_parquet(self.path)
self.data = pd.read_parquet(self.path).astype(REGSITRY_DTYPE)
else:
raise TypeError("Unknown registry type")

Expand Down

0 comments on commit 63d79d7

Please sign in to comment.