def pct_change(self, periods: int=1) -> 'DataFrame':
    "\n        Percentage change between the current and a prior element.\n\n        .. note:: the current implementation of this API uses Spark's Window without\n            specifying partition specification. This leads to move all data into\n            single partition in single machine and could cause serious\n            performance degradation. Avoid this method against very large dataset.\n\n        Parameters\n        ----------\n        periods : int, default 1\n            Periods to shift for forming percent change.\n\n        Returns\n        -------\n        DataFrame\n\n        Examples\n        --------\n        Percentage change in French franc, Deutsche Mark, and Italian lira\n        from 1980-01-01 to 1980-03-01.\n\n        >>> df = ps.DataFrame({\n        ...     'FR': [4.0405, 4.0963, 4.3149],\n        ...     'GR': [1.7246, 1.7482, 1.8519],\n        ...     'IT': [804.74, 810.01, 860.13]},\n        ...     index=['1980-01-01', '1980-02-01', '1980-03-01'])\n        >>> df\n                        FR      GR      IT\n        1980-01-01  4.0405  1.7246  804.74\n        1980-02-01  4.0963  1.7482  810.01\n        1980-03-01  4.3149  1.8519  860.13\n\n        >>> df.pct_change()\n                          FR        GR        IT\n        1980-01-01       NaN       NaN       NaN\n        1980-02-01  0.013810  0.013684  0.006549\n        1980-03-01  0.053365  0.059318  0.061876\n\n        You can set periods to shift for forming percent change\n\n        >>> df.pct_change(2)\n                          FR        GR       IT\n        1980-01-01       NaN       NaN      NaN\n        1980-02-01       NaN       NaN      NaN\n        1980-03-01  0.067912  0.073814  0.06883\n        "
    window = Window.orderBy(NATURAL_ORDER_COLUMN_NAME).rowsBetween((- periods), (- periods))

    def op(psser: ps.Series) -> Column:
        prev_row = F.lag(psser.spark.column, periods).over(window)
        return ((psser.spark.column - prev_row) / prev_row).alias(psser._internal.data_spark_column_names[0])
    return self._apply_series_op(op, should_resolve=True)
Percentage change between the current and a prior element.

.. note:: the current implementation of this API uses Spark's Window without
    specifying partition specification. This leads to move all data into
    single partition in single machine and could cause serious
    performance degradation. Avoid this method against very large dataset.

Parameters
----------
periods : int, default 1
    Periods to shift for forming percent change.

Returns
-------
DataFrame

Examples
--------
Percentage change in French franc, Deutsche Mark, and Italian lira
from 1980-01-01 to 1980-03-01.

>>> df = ps.DataFrame({
...     'FR': [4.0405, 4.0963, 4.3149],
...     'GR': [1.7246, 1.7482, 1.8519],
...     'IT': [804.74, 810.01, 860.13]},
...     index=['1980-01-01', '1980-02-01', '1980-03-01'])
>>> df
                FR      GR      IT
1980-01-01  4.0405  1.7246  804.74
1980-02-01  4.0963  1.7482  810.01
1980-03-01  4.3149  1.8519  860.13

>>> df.pct_change()
                  FR        GR        IT
1980-01-01       NaN       NaN       NaN
1980-02-01  0.013810  0.013684  0.006549
1980-03-01  0.053365  0.059318  0.061876

You can set periods to shift for forming percent change

>>> df.pct_change(2)
                  FR        GR       IT
1980-01-01       NaN       NaN      NaN
1980-02-01       NaN       NaN      NaN
1980-03-01  0.067912  0.073814  0.06883
def pct_change(self, periods: int=1) -> 'DataFrame':
    "\n        Percentage change between the current and a prior element.\n\n        .. note:: the current implementation of this API uses Spark's Window without\n            specifying partition specification. This leads to move all data into\n            single partition in single machine and could cause serious\n            performance degradation. Avoid this method against very large dataset.\n\n        Parameters\n        ----------\n        periods : int, default 1\n            Periods to shift for forming percent change.\n\n        Returns\n        -------\n        DataFrame\n\n        Examples\n        --------\n        Percentage change in French franc, Deutsche Mark, and Italian lira\n        from 1980-01-01 to 1980-03-01.\n\n        >>> df = ps.DataFrame({\n        ...     'FR': [4.0405, 4.0963, 4.3149],\n        ...     'GR': [1.7246, 1.7482, 1.8519],\n        ...     'IT': [804.74, 810.01, 860.13]},\n        ...     index=['1980-01-01', '1980-02-01', '1980-03-01'])\n        >>> df\n                        FR      GR      IT\n        1980-01-01  4.0405  1.7246  804.74\n        1980-02-01  4.0963  1.7482  810.01\n        1980-03-01  4.3149  1.8519  860.13\n\n        >>> df.pct_change()\n                          FR        GR        IT\n        1980-01-01       NaN       NaN       NaN\n        1980-02-01  0.013810  0.013684  0.006549\n        1980-03-01  0.053365  0.059318  0.061876\n\n        You can set periods to shift for forming percent change\n\n        >>> df.pct_change(2)\n                          FR        GR       IT\n        1980-01-01       NaN       NaN      NaN\n        1980-02-01       NaN       NaN      NaN\n        1980-03-01  0.067912  0.073814  0.06883\n        "
    window = Window.orderBy(NATURAL_ORDER_COLUMN_NAME).rowsBetween((- periods), (- periods))

    def op(psser: ps.Series) -> Column:
        prev_row = F.lag(psser.spark.column, periods).over(window)
        return ((psser.spark.column - prev_row) / prev_row).alias(psser._internal.data_spark_column_names[0])
    return self._apply_series_op(op, should_resolve=True)