Skip to content

Commit f9c6e72

Browse files
authored
docs: add examples for dataframe.kurt, dataframe.std, dataframe.count (#232)
* docs: add examples for dataframe.kurt, dataframe.std, dataframe.count * update count example * update count example * update examples * update . to :
1 parent b62a07a commit f9c6e72

File tree

1 file changed

+87
-9
lines changed
  • third_party/bigframes_vendored/pandas/core

1 file changed

+87
-9
lines changed

third_party/bigframes_vendored/pandas/core/frame.py

+87-9
Original file line numberDiff line numberDiff line change
@@ -2597,14 +2597,14 @@ def any(self, *, axis=0, bool_only: bool = False):
25972597
<BLANKLINE>
25982598
[2 rows x 2 columns]
25992599
2600-
Checking if each column contains at least one True element (the default behavior without an explicit axis parameter).
2600+
Checking if each column contains at least one True element(the default behavior without an explicit axis parameter):
26012601
26022602
>>> df.any()
26032603
A True
26042604
B False
26052605
dtype: boolean
26062606
2607-
Checking if each row contains at least one True element.
2607+
Checking if each row contains at least one True element:
26082608
26092609
>>> df.any(axis=1)
26102610
0 True
@@ -2644,14 +2644,14 @@ def all(self, axis=0, *, bool_only: bool = False):
26442644
<BLANKLINE>
26452645
[2 rows x 2 columns]
26462646
2647-
Checking if all values in each column are True (the default behavior without an explicit axis parameter).
2647+
Checking if all values in each column are True(the default behavior without an explicit axis parameter):
26482648
26492649
>>> df.all()
26502650
A True
26512651
B False
26522652
dtype: boolean
26532653
2654-
Checking across rows to see if all values are True.
2654+
Checking across rows to see if all values are True:
26552655
26562656
>>> df.all(axis=1)
26572657
0 False
@@ -2688,14 +2688,14 @@ def prod(self, axis=0, *, numeric_only: bool = False):
26882688
<BLANKLINE>
26892689
[3 rows x 2 columns]
26902690
2691-
Calculating the product of each column (the default behavior without an explicit axis parameter).
2691+
Calculating the product of each column(the default behavior without an explicit axis parameter):
26922692
26932693
>>> df.prod()
26942694
A 6.0
26952695
B 160.875
26962696
dtype: Float64
26972697
2698-
Calculating the product of each row.
2698+
Calculating the product of each row:
26992699
27002700
>>> df.prod(axis=1)
27012701
0 4.5
@@ -2911,11 +2911,37 @@ def skew(self, *, numeric_only: bool = False):
29112911
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
29122912

29132913
def kurt(self, *, numeric_only: bool = False):
2914-
"""Return unbiased kurtosis over requested axis.
2914+
"""Return unbiased kurtosis over columns.
29152915
29162916
Kurtosis obtained using Fisher's definition of
29172917
kurtosis (kurtosis of normal == 0.0). Normalized by N-1.
29182918
2919+
**Examples:**
2920+
2921+
>>> import bigframes.pandas as bpd
2922+
>>> bpd.options.display.progress_bar = None
2923+
2924+
>>> df = bpd.DataFrame({"A": [1, 2, 3, 4, 5],
2925+
... "B": [3, 4, 3, 2, 1],
2926+
... "C": [2, 2, 3, 2, 2]})
2927+
>>> df
2928+
A B C
2929+
0 1 3 2
2930+
1 2 4 2
2931+
2 3 3 3
2932+
3 4 2 2
2933+
4 5 1 2
2934+
<BLANKLINE>
2935+
[5 rows x 3 columns]
2936+
2937+
Calculating the kurtosis value of each column:
2938+
2939+
>>> df.kurt()
2940+
A -1.2
2941+
B -0.177515
2942+
C 5.0
2943+
dtype: Float64
2944+
29192945
Args:
29202946
numeric_only (bool, default False):
29212947
Include only float, int, boolean columns.
@@ -2926,10 +2952,36 @@ def kurt(self, *, numeric_only: bool = False):
29262952
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
29272953

29282954
def std(self, *, numeric_only: bool = False):
2929-
"""Return sample standard deviation over requested axis.
2955+
"""Return sample standard deviation over columns.
29302956
29312957
Normalized by N-1 by default.
29322958
2959+
**Examples:**
2960+
2961+
>>> import bigframes.pandas as bpd
2962+
>>> bpd.options.display.progress_bar = None
2963+
2964+
>>> df = bpd.DataFrame({"A": [1, 2, 3, 4, 5],
2965+
... "B": [3, 4, 3, 2, 1],
2966+
... "C": [2, 2, 3, 2, 2]})
2967+
>>> df
2968+
A B C
2969+
0 1 3 2
2970+
1 2 4 2
2971+
2 3 3 3
2972+
3 4 2 2
2973+
4 5 1 2
2974+
<BLANKLINE>
2975+
[5 rows x 3 columns]
2976+
2977+
Calculating the standard deviation of each column:
2978+
2979+
>>> df.std()
2980+
A 1.581139
2981+
B 1.140175
2982+
C 0.447214
2983+
dtype: Float64
2984+
29332985
Args:
29342986
numeric_only (bool. default False):
29352987
Default False. Include only float, int, boolean columns.
@@ -2941,11 +2993,37 @@ def std(self, *, numeric_only: bool = False):
29412993

29422994
def count(self, *, numeric_only: bool = False):
29432995
"""
2944-
Count non-NA cells for each column or row.
2996+
Count non-NA cells for each column.
29452997
29462998
The values `None`, `NaN`, `NaT`, and optionally `numpy.inf` (depending
29472999
on `pandas.options.mode.use_inf_as_na`) are considered NA.
29483000
3001+
**Examples:**
3002+
3003+
>>> import bigframes.pandas as bpd
3004+
>>> bpd.options.display.progress_bar = None
3005+
3006+
>>> df = bpd.DataFrame({"A": [1, None, 3, 4, 5],
3007+
... "B": [1, 2, 3, 4, 5],
3008+
... "C": [None, 3.5, None, 4.5, 5.0]})
3009+
>>> df
3010+
A B C
3011+
0 1.0 1 <NA>
3012+
1 <NA> 2 3.5
3013+
2 3.0 3 <NA>
3014+
3 4.0 4 4.5
3015+
4 5.0 5 5.0
3016+
<BLANKLINE>
3017+
[5 rows x 3 columns]
3018+
3019+
Counting non-NA values for each column:
3020+
3021+
>>> df.count()
3022+
A 4.0
3023+
B 5.0
3024+
C 3.0
3025+
dtype: Float64
3026+
29493027
Args:
29503028
numeric_only (bool, default False):
29513029
Include only `float`, `int` or `boolean` data.

0 commit comments

Comments
 (0)