Format values of cftimeindex as pd.Index.
(
index,
max_width,
offset,
separator=", ",
first_row_offset=0,
intermediate_row_end=",\n",
last_row_end="",
)
| 184 | |
| 185 | |
| 186 | def format_times( |
| 187 | index, |
| 188 | max_width, |
| 189 | offset, |
| 190 | separator=", ", |
| 191 | first_row_offset=0, |
| 192 | intermediate_row_end=",\n", |
| 193 | last_row_end="", |
| 194 | ): |
| 195 | """Format values of cftimeindex as pd.Index.""" |
| 196 | n_per_row = max(max_width // (CFTIME_REPR_LENGTH + len(separator)), 1) |
| 197 | n_rows = math.ceil(len(index) / n_per_row) |
| 198 | |
| 199 | representation = "" |
| 200 | for row in range(n_rows): |
| 201 | indent = first_row_offset if row == 0 else offset |
| 202 | row_end = last_row_end if row == n_rows - 1 else intermediate_row_end |
| 203 | times_for_row = index[row * n_per_row : (row + 1) * n_per_row] |
| 204 | representation += format_row( |
| 205 | times_for_row, indent=indent, separator=separator, row_end=row_end |
| 206 | ) |
| 207 | |
| 208 | return representation |
| 209 | |
| 210 | |
| 211 | def format_attrs(index, separator=", "): |
no test coverage detected
searching dependent graphs…