Skip to content

Commit

Permalink
add helper method for creating empty canonical dataframe
Browse files Browse the repository at this point in the history
  • Loading branch information
aaraney committed Sep 3, 2021
1 parent 908e000 commit 7985320
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions python/nwis_client/src/hydrotools/nwis_client/iv.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,3 +809,17 @@ def flatten_and_stringify(v):
value_groups = np.array_split(values, n_groups)

return list(map(lambda i: ",".join(i), value_groups))


def _create_empty_canonical_df() -> pd.DataFrame:
"""Returns an empty hydrotools canonical dataframe with correct field datatypes."""
cols = {
"value_time": pd.Series(dtype="datetime64[ns]"),
"variable_name": pd.Series(dtype="category"),
"usgs_site_code": pd.Series(dtype="category"),
"measurement_unit": pd.Series(dtype="category"),
"value": pd.Series(dtype="float32"),
"qualifiers": pd.Series(dtype="category"),
"series": pd.Series(dtype="category"),
}
return pd.DataFrame(cols, index=[])

0 comments on commit 7985320

Please sign in to comment.