Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 103 additions & 2 deletions third_party/bigframes_vendored/pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2852,6 +2852,33 @@ def sum(self, axis=0, *, numeric_only: bool = False):
def mean(self, axis=0, *, numeric_only: bool = False):
"""Return the mean of the values over the requested axis.

**Examples:**

>>> import bigframes.pandas as bpd
>>> bpd.options.display.progress_bar = None

>>> df = bpd.DataFrame({"A": [1, 3], "B": [2, 4]})
>>> df
A B
0 1 2
1 3 4
<BLANKLINE>
[2 rows x 2 columns]

Calculating the mean of each column (the default behavior without an explicit axis parameter).

>>> df.mean()
A 2.0
B 3.0
dtype: Float64

Calculating the mean of each row.

>>> df.mean(axis=1)
0 1.5
1 3.5
dtype: Float64

Args:
axis ({index (0), columns (1)}):
Axis for the function to be applied on.
Expand All @@ -2865,7 +2892,27 @@ def mean(self, axis=0, *, numeric_only: bool = False):
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

def median(self, *, numeric_only: bool = False, exact: bool = False):
"""Return the median of the values over the requested axis.
"""Return the median of the values over colunms.

**Examples:**

>>> import bigframes.pandas as bpd
>>> bpd.options.display.progress_bar = None

>>> df = bpd.DataFrame({"A": [1, 3], "B": [2, 4]})
>>> df
A B
0 1 2
1 3 4
<BLANKLINE>
[2 rows x 2 columns]

Finding the median value of each column.

>>> df.median()
A 1.0
B 2.0
dtype: Float64

Args:
numeric_only (bool. default False):
Expand All @@ -2884,6 +2931,34 @@ def var(self, axis=0, *, numeric_only: bool = False):

Normalized by N-1 by default.

**Examples:**

>>> import bigframes.pandas as bpd
>>> bpd.options.display.progress_bar = None

>>> df = bpd.DataFrame({"A": [1, 3], "B": [2, 4]})
>>> df
A B
0 1 2
1 3 4
<BLANKLINE>
[2 rows x 2 columns]

Calculating the variance of each column (the default behavior without an explicit axis parameter).

>>> df.var()
A 2.0
B 2.0
dtype: Float64

Calculating the variance of each row.

>>> df.var(axis=1)
0 0.5
1 0.5
dtype: Float64


Args:
axis ({index (0), columns (1)}):
Axis for the function to be applied on.
Expand All @@ -2897,10 +2972,36 @@ def var(self, axis=0, *, numeric_only: bool = False):
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

def skew(self, *, numeric_only: bool = False):
"""Return unbiased skew over requested axis.
"""Return unbiased skew over columns.

Normalized by N-1.

**Examples:**

>>> import bigframes.pandas as bpd
>>> bpd.options.display.progress_bar = None

>>> df = bpd.DataFrame({'A': [1, 2, 3, 4, 5],
... 'B': [5, 4, 3, 2, 1],
... 'C': [2, 2, 3, 2, 2]})
>>> df
A B C
0 1 5 2
1 2 4 2
2 3 3 3
3 4 2 2
4 5 1 2
<BLANKLINE>
[5 rows x 3 columns]

Calculating the skewness of each column.

>>> df.skew()
A 0.0
B 0.0
C 2.236068
dtype: Float64

Args:
numeric_only (bool, default False):
Include only float, int, boolean columns.
Expand Down