(
self,
*,
method: FillnaOptions,
inplace: bool = False,
limit: int | None = None,
limit_area: Literal["inside", "outside"] | None = None,
)
| 1841 | |
| 1842 | @final |
| 1843 | def pad_or_backfill( |
| 1844 | self, |
| 1845 | *, |
| 1846 | method: FillnaOptions, |
| 1847 | inplace: bool = False, |
| 1848 | limit: int | None = None, |
| 1849 | limit_area: Literal["inside", "outside"] | None = None, |
| 1850 | ) -> list[Block]: |
| 1851 | values = self.values |
| 1852 | |
| 1853 | kwargs: dict[str, Any] = {"method": method, "limit": limit} |
| 1854 | if "limit_area" in inspect.signature(values._pad_or_backfill).parameters: |
| 1855 | kwargs["limit_area"] = limit_area |
| 1856 | elif limit_area is not None: |
| 1857 | raise NotImplementedError( |
| 1858 | f"{type(values).__name__} does not implement limit_area " |
| 1859 | "(added in pandas 2.2). 3rd-party ExtensionArray authors " |
| 1860 | "need to add this argument to _pad_or_backfill." |
| 1861 | ) |
| 1862 | |
| 1863 | if values.ndim == 2: |
| 1864 | # NDArrayBackedExtensionArray.fillna assumes axis=0 |
| 1865 | new_values = values.T._pad_or_backfill(**kwargs).T |
| 1866 | else: |
| 1867 | new_values = values._pad_or_backfill(**kwargs) |
| 1868 | return [self.make_block_same_class(new_values)] |
| 1869 | |
| 1870 | |
| 1871 | class ExtensionBlock(EABackedBlock): |
nothing calls this directly
no test coverage detected