Skip to content

Commit

Permalink
add doc str
Browse files Browse the repository at this point in the history
  • Loading branch information
lixiliu committed Nov 14, 2024
1 parent aaf0833 commit 03c6b81
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/chronify/time_series_mapper_representative.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def map_time(self) -> None:
def _create_mapping_dataframe_tz_naive(
self, dft: pd.DataFrame, to_time_col: str
) -> pd.DataFrame:
"""Create tz-naive time mapping dataframe"""
dfm = dft.copy()
dfm["month"] = dfm[to_time_col].dt.month
dow = dfm[to_time_col].dt.day_of_week
Expand All @@ -100,6 +101,7 @@ def _create_mapping_dataframe_tz_naive(
def _create_mapping_dataframe_tz_aware(
self, dft: pd.DataFrame, to_time_col: str
) -> pd.DataFrame:
"""Create tz-aware time mapping dataframe according to to_schema.time_config"""
with self._engine.connect() as conn:
table = Table(self.from_schema.name, self._metadata)
stmt = select(table.c["time_zone"]).distinct().where(table.c["time_zone"].is_not(None))
Expand Down Expand Up @@ -128,6 +130,7 @@ def _create_mapping_dataframe_tz_aware(
return dfm

def _apply_mapping(self, map_table_schema: TableSchema):
"""Apply mapping to create result as a view according to_schema"""
left_table = Table(self.from_schema.name, self._metadata)
right_table = Table(map_table_schema.name, self._metadata)
left_table_columns = [x.name for x in left_table.columns]
Expand Down

0 comments on commit 03c6b81

Please sign in to comment.