Return the monthly offset string. Return "cs" if all dates are the first days of the month, "ce" if all dates are the last day of the month, None otherwise. Replicated pandas._libs.tslibs.resolution.month_position_check but without business offset handling.
(dates)
| 246 | |
| 247 | |
| 248 | def month_anchor_check(dates): |
| 249 | """Return the monthly offset string. |
| 250 | |
| 251 | Return "cs" if all dates are the first days of the month, |
| 252 | "ce" if all dates are the last day of the month, |
| 253 | None otherwise. |
| 254 | |
| 255 | Replicated pandas._libs.tslibs.resolution.month_position_check |
| 256 | but without business offset handling. |
| 257 | """ |
| 258 | calendar_end = True |
| 259 | calendar_start = True |
| 260 | |
| 261 | for date in dates: |
| 262 | if calendar_start: |
| 263 | calendar_start &= date.day == 1 |
| 264 | |
| 265 | if calendar_end: |
| 266 | cal = date.day == date.daysinmonth |
| 267 | calendar_end &= cal |
| 268 | elif not calendar_start: |
| 269 | break |
| 270 | |
| 271 | if calendar_end: |
| 272 | return "ce" |
| 273 | elif calendar_start: |
| 274 | return "cs" |
| 275 | else: |
| 276 | return None |
no outgoing calls
no test coverage detected
searching dependent graphs…