(
self, file_or_df: [Path, pd.DataFrame], *, is_begin_end: bool = False, as_set: bool = False
)
| 146 | return datetime_d.strftime(self.calendar_format) |
| 147 | |
| 148 | def _get_date( |
| 149 | self, file_or_df: [Path, pd.DataFrame], *, is_begin_end: bool = False, as_set: bool = False |
| 150 | ) -> Iterable[pd.Timestamp]: |
| 151 | if not isinstance(file_or_df, pd.DataFrame): |
| 152 | df = self._get_source_data(file_or_df) |
| 153 | else: |
| 154 | df = file_or_df |
| 155 | if df.empty or self.date_field_name not in df.columns.tolist(): |
| 156 | _calendars = pd.Series(dtype=np.float32) |
| 157 | else: |
| 158 | _calendars = df[self.date_field_name] |
| 159 | |
| 160 | if is_begin_end and as_set: |
| 161 | return (_calendars.min(), _calendars.max()), set(_calendars) |
| 162 | elif is_begin_end: |
| 163 | return _calendars.min(), _calendars.max() |
| 164 | elif as_set: |
| 165 | return set(_calendars) |
| 166 | else: |
| 167 | return _calendars.tolist() |
| 168 | |
| 169 | def _get_source_data(self, file_path: Path) -> pd.DataFrame: |
| 170 | df = read_as_df(file_path, low_memory=False) |
no test coverage detected