(
self,
axis=0,
skipna=True,
ddof=1,
numeric_only=False,
split_every=False,
**kwargs,
)
| 1535 | |
| 1536 | @derived_from(pd.DataFrame) |
| 1537 | def std( |
| 1538 | self, |
| 1539 | axis=0, |
| 1540 | skipna=True, |
| 1541 | ddof=1, |
| 1542 | numeric_only=False, |
| 1543 | split_every=False, |
| 1544 | **kwargs, |
| 1545 | ): |
| 1546 | _raise_if_object_series(self, "std") |
| 1547 | axis = self._validate_axis(axis) |
| 1548 | numeric_dd = self |
| 1549 | meta = meta_nonempty(self._meta).std( |
| 1550 | axis=axis, skipna=skipna, ddof=ddof, numeric_only=numeric_only |
| 1551 | ) |
| 1552 | needs_time_conversion, time_cols = False, None |
| 1553 | if is_dataframe_like(self._meta): |
| 1554 | if axis == 0: |
| 1555 | numeric_dd = numeric_dd[list(meta.index)] |
| 1556 | else: |
| 1557 | numeric_dd = numeric_dd.copy() |
| 1558 | |
| 1559 | if numeric_only is True: |
| 1560 | _meta = numeric_dd._meta.select_dtypes(include=[np.number]) |
| 1561 | else: |
| 1562 | _meta = numeric_dd._meta |
| 1563 | time_cols = _meta.select_dtypes(include=["datetime", "timedelta"]).columns |
| 1564 | if len(time_cols) > 0: |
| 1565 | if axis == 1 and len(time_cols) != len(self.columns): |
| 1566 | numeric_dd = from_pandas( |
| 1567 | meta_frame_constructor(self)( |
| 1568 | {"_": meta_series_constructor(self)([np.nan])}, |
| 1569 | index=self.index, |
| 1570 | ), |
| 1571 | npartitions=self.npartitions, |
| 1572 | ) |
| 1573 | else: |
| 1574 | needs_time_conversion = True |
| 1575 | if axis == 1: |
| 1576 | numeric_dd = numeric_dd.astype(f"datetime64[{meta.array.unit}]") |
| 1577 | for col in time_cols: |
| 1578 | numeric_dd[col] = _convert_to_numeric(numeric_dd[col], skipna) |
| 1579 | else: |
| 1580 | needs_time_conversion = is_datetime64_any_dtype(self._meta) |
| 1581 | if needs_time_conversion: |
| 1582 | numeric_dd = _convert_to_numeric(self, skipna) |
| 1583 | |
| 1584 | units = None |
| 1585 | if needs_time_conversion and time_cols is not None: |
| 1586 | units = [getattr(self._meta[c].array, "unit", None) for c in time_cols] |
| 1587 | |
| 1588 | if axis == 1: |
| 1589 | _kwargs = ( |
| 1590 | {} |
| 1591 | if not needs_time_conversion |
| 1592 | else {"unit": meta.array.unit, "dtype": meta.dtype} |
| 1593 | ) |
| 1594 | return numeric_dd.map_partitions( |
nothing calls this directly
no test coverage detected