From 639cb34960b2c909310bcc9af64d491366249433 Mon Sep 17 00:00:00 2001 From: milkshakeiii Date: Fri, 5 Apr 2024 19:00:17 +0000 Subject: [PATCH 1/5] docs: add examples for at/iat --- .../bigframes_vendored/pandas/core/frame.py | 46 +++++++++++++++++++ .../bigframes_vendored/pandas/core/series.py | 32 +++++++++++++ 2 files changed, 78 insertions(+) diff --git a/third_party/bigframes_vendored/pandas/core/frame.py b/third_party/bigframes_vendored/pandas/core/frame.py index e5aa47ad3e..eeadbdd241 100644 --- a/third_party/bigframes_vendored/pandas/core/frame.py +++ b/third_party/bigframes_vendored/pandas/core/frame.py @@ -5362,6 +5362,29 @@ def loc(self): def iat(self): """Access a single value for a row/column pair by integer position. + **Examples:** + + >>> df = bpd.DataFrame([[0, 2, 3], [0, 4, 1], [10, 20, 30]], + ... columns=['A', 'B', 'C']) + >>> bpd.options.display.progress_bar = None + >>> df + A B C + 0 0 2 3 + 1 0 4 1 + 2 10 20 30 + + [3 rows × 3 columns] + + Get value at specified row/column pair + + >>> df.iat[1, 2] + 1 + + Get value within a series + + >>> df.loc[0].iat[1] + 2 + Returns: bigframes.core.indexers.IatDataFrameIndexer: Indexers object. """ @@ -5371,6 +5394,29 @@ def iat(self): def at(self): """Access a single value for a row/column label pair. + **Examples:** + + >>> df = pd.DataFrame([[0, 2, 3], [0, 4, 1], [10, 20, 30]], + index=[4, 5, 6], columns=['A', 'B', 'C']) + >>> bpd.options.display.progress_bar = None + >>> df + A B C + 4 0 2 3 + 5 0 4 1 + 6 10 20 30 + + [3 rows × 3 columns] + + Get value at specified row/column pair + + >>> df.at[4, 'B'] + 2 + + Get value within a series + + >>> df.loc[5].at['B'] + 4 + Returns: bigframes.core.indexers.AtDataFrameIndexer: Indexers object. """ diff --git a/third_party/bigframes_vendored/pandas/core/series.py b/third_party/bigframes_vendored/pandas/core/series.py index 785755a562..e9d5f0fc9b 100644 --- a/third_party/bigframes_vendored/pandas/core/series.py +++ b/third_party/bigframes_vendored/pandas/core/series.py @@ -3308,6 +3308,21 @@ def loc(self): def iat(self): """Access a single value for a row/column pair by integer position. + **Examples:** + + >>> s = bpd.Series(bpd.Series([1, 2, 3])) + >>> bpd.options.display.progress_bar = None + >>> s + 0 1 + 1 2 + 2 3 + dtype: Int64 + + Get value at specified row number + + >>> s.iat[1] + 2 + Returns: bigframes.core.indexers.IatSeriesIndexer: Indexers object. """ @@ -3317,6 +3332,23 @@ def iat(self): def at(self): """Access a single value for a row/column label pair. + + **Examples:** + + >>> s = bpd.Series([1, 2, 3], index=['A', 'B', 'C']) + >>> bpd.options.display.progress_bar = None + >>> s + A 1 + B 2 + C 3 + dtype: Int64 + + Get value at specified row label + + >>> s.iat['B'] + 2 + + Returns: bigframes.core.indexers.AtSeriesIndexer: Indexers object. """ From 14a260f608c045970f3f588bee577aa30e1e59be Mon Sep 17 00:00:00 2001 From: milkshakeiii Date: Fri, 5 Apr 2024 21:15:43 +0000 Subject: [PATCH 2/5] fix example --- third_party/bigframes_vendored/pandas/core/frame.py | 4 +++- third_party/bigframes_vendored/pandas/core/series.py | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/third_party/bigframes_vendored/pandas/core/frame.py b/third_party/bigframes_vendored/pandas/core/frame.py index eeadbdd241..5fcec2459b 100644 --- a/third_party/bigframes_vendored/pandas/core/frame.py +++ b/third_party/bigframes_vendored/pandas/core/frame.py @@ -5364,6 +5364,7 @@ def iat(self): **Examples:** + >>> import bigframes.pandas as bpd >>> df = bpd.DataFrame([[0, 2, 3], [0, 4, 1], [10, 20, 30]], ... columns=['A', 'B', 'C']) >>> bpd.options.display.progress_bar = None @@ -5396,8 +5397,9 @@ def at(self): **Examples:** + >>> import bigframes.pandas as bpd >>> df = pd.DataFrame([[0, 2, 3], [0, 4, 1], [10, 20, 30]], - index=[4, 5, 6], columns=['A', 'B', 'C']) + ... index=[4, 5, 6], columns=['A', 'B', 'C']) >>> bpd.options.display.progress_bar = None >>> df A B C diff --git a/third_party/bigframes_vendored/pandas/core/series.py b/third_party/bigframes_vendored/pandas/core/series.py index e9d5f0fc9b..2627bb613e 100644 --- a/third_party/bigframes_vendored/pandas/core/series.py +++ b/third_party/bigframes_vendored/pandas/core/series.py @@ -3310,6 +3310,7 @@ def iat(self): **Examples:** + >>> import bigframes.pandas as bpd >>> s = bpd.Series(bpd.Series([1, 2, 3])) >>> bpd.options.display.progress_bar = None >>> s @@ -3332,9 +3333,9 @@ def iat(self): def at(self): """Access a single value for a row/column label pair. - **Examples:** + >>> import bigframes.pandas as bpd >>> s = bpd.Series([1, 2, 3], index=['A', 'B', 'C']) >>> bpd.options.display.progress_bar = None >>> s @@ -3345,7 +3346,7 @@ def at(self): Get value at specified row label - >>> s.iat['B'] + >>> s.at['B'] 2 From 0cfe563c3bf7f290487bbd99d0f50eb4aceb61d5 Mon Sep 17 00:00:00 2001 From: milkshakeiii Date: Fri, 5 Apr 2024 23:04:37 +0000 Subject: [PATCH 3/5] fix example --- third_party/bigframes_vendored/pandas/core/frame.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/third_party/bigframes_vendored/pandas/core/frame.py b/third_party/bigframes_vendored/pandas/core/frame.py index 5fcec2459b..f77e3c7abc 100644 --- a/third_party/bigframes_vendored/pandas/core/frame.py +++ b/third_party/bigframes_vendored/pandas/core/frame.py @@ -5369,12 +5369,12 @@ def iat(self): ... columns=['A', 'B', 'C']) >>> bpd.options.display.progress_bar = None >>> df - A B C - 0 0 2 3 - 1 0 4 1 - 2 10 20 30 + A B C + 0 0 2 3 + 1 0 4 1 + 2 10 20 30 - [3 rows × 3 columns] + [3 rows x 3 columns] Get value at specified row/column pair @@ -5407,7 +5407,7 @@ def at(self): 5 0 4 1 6 10 20 30 - [3 rows × 3 columns] + [3 rows x 3 columns] Get value at specified row/column pair From 5aa92004fadd2f543a637eb0662c888dc7bc5a7a Mon Sep 17 00:00:00 2001 From: milkshakeiii Date: Sat, 6 Apr 2024 00:20:42 +0000 Subject: [PATCH 4/5] fix example --- third_party/bigframes_vendored/pandas/core/frame.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/third_party/bigframes_vendored/pandas/core/frame.py b/third_party/bigframes_vendored/pandas/core/frame.py index f77e3c7abc..4db1604911 100644 --- a/third_party/bigframes_vendored/pandas/core/frame.py +++ b/third_party/bigframes_vendored/pandas/core/frame.py @@ -5398,14 +5398,14 @@ def at(self): **Examples:** >>> import bigframes.pandas as bpd - >>> df = pd.DataFrame([[0, 2, 3], [0, 4, 1], [10, 20, 30]], + >>> df = bpd.DataFrame([[0, 2, 3], [0, 4, 1], [10, 20, 30]], ... index=[4, 5, 6], columns=['A', 'B', 'C']) >>> bpd.options.display.progress_bar = None >>> df - A B C - 4 0 2 3 - 5 0 4 1 - 6 10 20 30 + A B C + 0 0 2 3 + 1 0 4 1 + 2 10 20 30 [3 rows x 3 columns] From 5f67a84137ec83c87e68a34ac5a7e34c3fef6536 Mon Sep 17 00:00:00 2001 From: milkshakeiii Date: Sat, 6 Apr 2024 03:46:00 +0000 Subject: [PATCH 5/5] fix example --- third_party/bigframes_vendored/pandas/core/frame.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/third_party/bigframes_vendored/pandas/core/frame.py b/third_party/bigframes_vendored/pandas/core/frame.py index 4db1604911..ed615000c1 100644 --- a/third_party/bigframes_vendored/pandas/core/frame.py +++ b/third_party/bigframes_vendored/pandas/core/frame.py @@ -5402,10 +5402,10 @@ def at(self): ... index=[4, 5, 6], columns=['A', 'B', 'C']) >>> bpd.options.display.progress_bar = None >>> df - A B C - 0 0 2 3 - 1 0 4 1 - 2 10 20 30 + A B C + 4 0 2 3 + 5 0 4 1 + 6 10 20 30 [3 rows x 3 columns]