Format attributes of CFTimeIndex for __repr__.
(index, separator=", ")
| 209 | |
| 210 | |
| 211 | def format_attrs(index, separator=", "): |
| 212 | """Format attributes of CFTimeIndex for __repr__.""" |
| 213 | attrs = { |
| 214 | "dtype": f"'{index.dtype}'", |
| 215 | "length": f"{len(index)}", |
| 216 | "calendar": f"{index.calendar!r}", |
| 217 | "freq": f"{index.freq!r}", |
| 218 | } |
| 219 | |
| 220 | attrs_str = [f"{k}={v}" for k, v in attrs.items()] |
| 221 | attrs_str = f"{separator}".join(attrs_str) |
| 222 | return attrs_str |
| 223 | |
| 224 | |
| 225 | class CFTimeIndex(pd.Index): |