Reassign code values as -1 if their corresponding levels are NaN. Parameters ---------- code : Index Code to reassign. level : np.ndarray Level to check for missing values (NaN, NaT, None). Returns ------- new
(self, level: Index, code: np.ndarray)
| 341 | return result |
| 342 | |
| 343 | def _validate_codes(self, level: Index, code: np.ndarray) -> np.ndarray: |
| 344 | """ |
| 345 | Reassign code values as -1 if their corresponding levels are NaN. |
| 346 | |
| 347 | Parameters |
| 348 | ---------- |
| 349 | code : Index |
| 350 | Code to reassign. |
| 351 | level : np.ndarray |
| 352 | Level to check for missing values (NaN, NaT, None). |
| 353 | |
| 354 | Returns |
| 355 | ------- |
| 356 | new code where code value = -1 if it corresponds |
| 357 | to a level with missing values (NaN, NaT, None). |
| 358 | """ |
| 359 | null_mask = isna(level) |
| 360 | if np.any(null_mask): |
| 361 | code = np.where(null_mask[code], -1, code) |
| 362 | return code |
| 363 | |
| 364 | def _verify_integrity( |
| 365 | self, |
no test coverage detected