Skip to content

Commit b7b80d4

Browse files
author
wdyy20041223
committed
fix: format issues for ruff compliance
1 parent cb13451 commit b7b80d4

File tree

1 file changed

+38
-33
lines changed

1 file changed

+38
-33
lines changed

pandas/core/generic.py

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2227,7 +2227,7 @@ def to_excel(
22272227
.. versionadded:: 1.2.0
22282228
engine_kwargs : dict, optional
22292229
Arbitrary keyword arguments passed to excel engine.
2230-
2230+
22312231
See Also
22322232
--------
22332233
to_csv : Write DataFrame to a comma-separated values (csv) file.
@@ -2398,19 +2398,19 @@ def to_json(
23982398
throw ValueError if incorrect 'orient' since others are not
23992399
list-like.
24002400
compression : str or dict, default 'infer'
2401-
For on-the-fly compression of the output data. If 'infer' and 'path_or_buf' is
2402-
path-like, then detect compression from the following extensions: '.gz',
2401+
For on-the-fly compression of the output data. If 'infer' and 'path_or_buf'
2402+
is path-like, then detect compression from the following extensions: '.gz',
24032403
'.bz2', '.zip', '.xz', '.zst', '.tar', '.tar.gz', '.tar.xz' or '.tar.bz2'
24042404
(otherwise no compression).
24052405
Set to ``None`` for no compression.
24062406
Can also be a dict with key ``'method'`` set
2407-
to one of {``'zip'``, ``'gzip'``, ``'bz2'``, ``'zstd'``, ``'xz'``, ``'tar'``} and
2408-
other key-value pairs are forwarded to
2407+
to one of {``'zip'``, ``'gzip'``, ``'bz2'``, ``'zstd'``, ``'xz'``,
2408+
``'tar'``} and other key-value pairs are forwarded to
24092409
``zipfile.ZipFile``, ``gzip.GzipFile``,
24102410
``bz2.BZ2File``, ``zstandard.ZstdCompressor``, ``lzma.LZMAFile`` or
24112411
``tarfile.TarFile``, respectively.
2412-
As an example, the following could be passed for faster compression and to create
2413-
a reproducible gzip archive:
2412+
As an example, the following could be passed for faster compression and
2413+
to create a reproducible gzip archive:
24142414
``compression={'method': 'gzip', 'compresslevel': 1, 'mtime': 1}``.
24152415
24162416
.. versionchanged:: 1.4.0 Zstandard support.
@@ -3081,13 +3081,13 @@ def to_pickle(
30813081
(otherwise no compression).
30823082
Set to ``None`` for no compression.
30833083
Can also be a dict with key ``'method'`` set
3084-
to one of {``'zip'``, ``'gzip'``, ``'bz2'``, ``'zstd'``, ``'xz'``, ``'tar'``} and
3085-
other key-value pairs are forwarded to
3084+
to one of {``'zip'``, ``'gzip'``, ``'bz2'``, ``'zstd'``, ``'xz'``,
3085+
``'tar'``} and other key-value pairs are forwarded to
30863086
``zipfile.ZipFile``, ``gzip.GzipFile``,
30873087
``bz2.BZ2File``, ``zstandard.ZstdCompressor``, ``lzma.LZMAFile`` or
30883088
``tarfile.TarFile``, respectively.
3089-
As an example, the following could be passed for faster compression and to create
3090-
a reproducible gzip archive:
3089+
As an example, the following could be passed for faster compression and
3090+
to create a reproducible gzip archive:
30913091
``compression={'method': 'gzip', 'compresslevel': 1, 'mtime': 1}``.
30923092
protocol : int
30933093
Int which indicates which protocol should be used by the pickler,
@@ -3853,19 +3853,19 @@ def to_csv(
38533853
defaults to 'utf-8'. `encoding` is not supported if `path_or_buf`
38543854
is a non-binary file object.
38553855
compression : str or dict, default 'infer'
3856-
For on-the-fly compression of the output data. If 'infer' and 'path_or_buf' is
3857-
path-like, then detect compression from the following extensions: '.gz',
3856+
For on-the-fly compression of the output data. If 'infer' and 'path_or_buf'
3857+
is path-like, then detect compression from the following extensions: '.gz',
38583858
'.bz2', '.zip', '.xz', '.zst', '.tar', '.tar.gz', '.tar.xz' or '.tar.bz2'
38593859
(otherwise no compression).
38603860
Set to ``None`` for no compression.
38613861
Can also be a dict with key ``'method'`` set
3862-
to one of {``'zip'``, ``'gzip'``, ``'bz2'``, ``'zstd'``, ``'xz'``, ``'tar'``} and
3863-
other key-value pairs are forwarded to
3862+
to one of {``'zip'``, ``'gzip'``, ``'bz2'``, ``'zstd'``, ``'xz'``,
3863+
``'tar'``} and other key-value pairs are forwarded to
38643864
``zipfile.ZipFile``, ``gzip.GzipFile``,
38653865
``bz2.BZ2File``, ``zstandard.ZstdCompressor``, ``lzma.LZMAFile`` or
38663866
``tarfile.TarFile``, respectively.
3867-
As an example, the following could be passed for faster compression and to create
3868-
a reproducible gzip archive:
3867+
As an example, the following could be passed for faster compression and
3868+
to create a reproducible gzip archive:
38693869
``compression={'method': 'gzip', 'compresslevel': 1, 'mtime': 1}``.
38703870
38713871
May be a dict with key 'method' as compression mode
@@ -9039,8 +9039,8 @@ def asfreq(
90399039
Returns the original data conformed to a new index with the specified
90409040
frequency.
90419041
9042-
If the index of this Series/DataFrame is a :class:`~pandas.PeriodIndex`, the new index
9043-
is the result of transforming the original index with
9042+
If the index of this Series/DataFrame is a :class:`~pandas.PeriodIndex`, the
9043+
new index is the result of transforming the original index with
90449044
:meth:`PeriodIndex.asfreq <pandas.PeriodIndex.asfreq>` (so the original index
90459045
will map one-to-one to the new index).
90469046
@@ -9981,7 +9981,8 @@ def align(
99819981
* inner: use intersection of keys from both frames,
99829982
preserve the order of the left keys.
99839983
9984-
axis : {0 or 'index', 1 or 'columns'} for Series, {0 or 'index', 1 or 'columns'} for DataFrame, default None
9984+
axis : {0 or 'index', 1 or 'columns'} for Series,
9985+
{0 or 'index', 1 or 'columns'} for DataFrame, default None
99859986
Align on index (0), columns (1), or both (None).
99869987
level : int or level name, default None
99879988
Broadcast across a level, matching Index values on the
@@ -12332,7 +12333,8 @@ def rolling(
1233212333
Minimum number of observations in window required to have a value;
1233312334
otherwise, result is ``np.nan``.
1233412335
12335-
For a window that is specified by an offset, ``min_periods`` will default to 1.
12336+
For a window that is specified by an offset, ``min_periods`` will default
12337+
to 1.
1233612338
1233712339
For a window that is specified by an integer, ``min_periods`` will default
1233812340
to the size of the window.
@@ -12477,8 +12479,8 @@ def rolling(
1247712479
1247812480
**min_periods**
1247912481
12480-
Rolling sum with a window length of 2 observations, but only needs a minimum of 1
12481-
observation to calculate a value.
12482+
Rolling sum with a window length of 2 observations, but only needs a minimum
12483+
of 1 observation to calculate a value.
1248212484
1248312485
>>> df.rolling(2, min_periods=1).sum()
1248412486
B
@@ -12566,8 +12568,8 @@ def expanding(
1256612568
"""
1256712569
Provide expanding window calculations.
1256812570
12569-
An expanding window yields the value of an aggregation statistic with all the data
12570-
available up to that point in time.
12571+
An expanding window yields the value of an aggregation statistic with all the
12572+
data available up to that point in time.
1257112573
1257212574
Parameters
1257312575
----------
@@ -12649,9 +12651,10 @@ def ewm(
1264912651
Provide exponentially weighted (EW) calculations.
1265012652
1265112653
Exactly one of ``com``, ``span``, ``halflife``, or ``alpha`` must be
12652-
provided if ``times`` is not provided. If ``times`` is provided and ``adjust=True``,
12653-
``halflife`` and one of ``com``, ``span`` or ``alpha`` may be provided.
12654-
If ``times`` is provided and ``adjust=False``, ``halflife`` must be the only
12654+
provided if ``times`` is not provided. If ``times`` is provided and
12655+
``adjust=True``, ``halflife`` and one of ``com``, ``span`` or ``alpha`` may be
12656+
provided. If ``times`` is provided and ``adjust=False``, ``halflife`` must be
12657+
the only
1265512658
provided decay-specification parameter.
1265612659
1265712660
Parameters
@@ -12689,13 +12692,14 @@ def ewm(
1268912692
Divide by decaying adjustment factor in beginning periods to account
1269012693
for imbalance in relative weightings (viewing EWMA as a moving average).
1269112694
12692-
- When ``adjust=True`` (default), the EW function is calculated using weights
12693-
:math:`w_i = (1 - \alpha)^i`. For example, the EW moving average of the series
12695+
- When ``adjust=True`` (default), the EW function is calculated using
12696+
weights :math:`w_i = (1 - \alpha)^i`. For example, the EW moving average
12697+
of the series
1269412698
[:math:`x_0, x_1, ..., x_t`] would be:
1269512699
1269612700
.. math::
12697-
y_t = \frac{x_t + (1 - \alpha)x_{t-1} + (1 - \alpha)^2 x_{t-2} + ... + (1 -
12698-
\alpha)^t x_0}{1 + (1 - \alpha) + (1 - \alpha)^2 + ... + (1 - \alpha)^t}
12701+
y_t = \frac{x_t + (1 - \alpha)x_{t-1} + (1 - \alpha)^2 x_{t-2} + ... +
12702+
(1 - \alpha)^t x_0}{1 + (1 - \alpha) + (1 - \alpha)^2 + ... + (1 - \alpha)^t}
1269912703
1270012704
- When ``adjust=False``, the exponentially weighted function is calculated
1270112705
recursively:
@@ -12708,7 +12712,8 @@ def ewm(
1270812712
ignore_na : bool, default False
1270912713
Ignore missing values when calculating weights.
1271012714
12711-
- When ``ignore_na=False`` (default), weights are based on absolute positions.
12715+
- When ``ignore_na=False`` (default), weights are based on absolute
12716+
positions.
1271212717
For example, the weights of :math:`x_0` and :math:`x_2` used in calculating
1271312718
the final weighted average of [:math:`x_0`, None, :math:`x_2`] are
1271412719
:math:`(1-\alpha)^2` and :math:`1` if ``adjust=True``, and

0 commit comments

Comments
 (0)