You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Address 26 mypy errors that appear with pandas-stubs 2.3.3.251219, which
adds stricter type checking for pandas Index methods.
Changes by category:
1. Added type: ignore comments with explanatory notes for cases where
pandas-stubs is stricter than actual pandas behavior:
- CFTimeIndex.__add__/__radd__ return Self instead of overloaded types
- Index.get_indexer accepts ndarray/list, not just Index
- CategoricalIndex.remove_unused_categories missing from stubs
- Series.where accepts broader argument types
- ExtensionArray.astype accepts ExtensionDtype
- Series[datetime].__setitem__ accepts np.nan (converts to NaT)
- MultiIndex.rename accepts list of names
2. Added explicit type annotations to help mypy infer correct types:
- coordinates.py: codes as list[np.ndarray]
- dataset.py: arrays and extension_arrays list types
- indexes.py: xr_index variable with PandasIndex | PandasMultiIndex
3. Removed redundant casts and fixed variable shadowing:
- Removed unnecessary cast in remove_unused_levels_categories
- Converted dict_keys to list for reorder_levels
- Fixed test_backends.py variable naming (tdf -> tdf_series)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
0 commit comments