From 609e4d9bde7f440b44ee00b29c8d6733b4437c61 Mon Sep 17 00:00:00 2001 From: Samesh Date: Mon, 22 Jul 2019 20:09:32 +0530 Subject: [PATCH 1/7] DOC:Remove DataFrame.append from the 10min intro Remove the `append` section from 10 min intro doc as complexity of that is very different than `list.append` closes #27518 --- doc/source/getting_started/10min.rst | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/doc/source/getting_started/10min.rst b/doc/source/getting_started/10min.rst index 510c7ef97aa98..5d8434de160cf 100644 --- a/doc/source/getting_started/10min.rst +++ b/doc/source/getting_started/10min.rst @@ -491,21 +491,6 @@ Another example that can be given is: right pd.merge(left, right, on='key') - -Append -~~~~~~ - -Append rows to a dataframe. See the :ref:`Appending ` -section. - -.. ipython:: python - - df = pd.DataFrame(np.random.randn(8, 4), columns=['A', 'B', 'C', 'D']) - df - s = df.iloc[3] - df.append(s, ignore_index=True) - - Grouping -------- From 1da9595049546dd0e744991b29ecd29e703a5c97 Mon Sep 17 00:00:00 2001 From: Samesh Date: Wed, 24 Jul 2019 06:37:03 +0530 Subject: [PATCH 2/7] add note on usage of append in 10min guide --- doc/source/getting_started/10min.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/source/getting_started/10min.rst b/doc/source/getting_started/10min.rst index 5d8434de160cf..ade0bc176a407 100644 --- a/doc/source/getting_started/10min.rst +++ b/doc/source/getting_started/10min.rst @@ -83,6 +83,14 @@ As you can see, the columns ``A``, ``B``, ``C``, and ``D`` are automatically tab completed. ``E`` is there as well; the rest of the attributes have been truncated for brevity. +.. note:: + +Adding a column to a DataFrame is relatively fast. Adding a row, however, +requires a full copy of the data and a construction of a new Index, which +may be expensive. Rather than iteratively building a DataFrame by +appending records, we recommend passing the pre-built list of records +to the DataFrame constructor. See :ref:`Appending to dataframe ` for more. + Viewing data ------------ From 5d219531177676933a7dcc42824d4029f6a1c349 Mon Sep 17 00:00:00 2001 From: Samesh Date: Wed, 24 Jul 2019 07:20:06 +0530 Subject: [PATCH 3/7] fixed wrong indentation of note directive --- doc/source/getting_started/10min.rst | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/source/getting_started/10min.rst b/doc/source/getting_started/10min.rst index ade0bc176a407..025cf2cd3fb98 100644 --- a/doc/source/getting_started/10min.rst +++ b/doc/source/getting_started/10min.rst @@ -84,12 +84,11 @@ tab completed. ``E`` is there as well; the rest of the attributes have been truncated for brevity. .. note:: - -Adding a column to a DataFrame is relatively fast. Adding a row, however, -requires a full copy of the data and a construction of a new Index, which -may be expensive. Rather than iteratively building a DataFrame by -appending records, we recommend passing the pre-built list of records -to the DataFrame constructor. See :ref:`Appending to dataframe ` for more. + Adding a column to a DataFrame is relatively fast. Adding a row, however, + requires a full copy of the data and a construction of a new Index, which + may be expensive. Rather than iteratively building a DataFrame by + appending records, we recommend passing the pre-built list of records + to the DataFrame constructor. See :ref:`Appending to dataframe ` for more. Viewing data ------------ From a7302f197ca07173f64fc2c5b5a9216932d5ac72 Mon Sep 17 00:00:00 2001 From: Samesh Date: Wed, 24 Jul 2019 21:45:24 +0530 Subject: [PATCH 4/7] moved the note directive from object creation section to end of concat section --- doc/source/getting_started/10min.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/source/getting_started/10min.rst b/doc/source/getting_started/10min.rst index 025cf2cd3fb98..fe9565144b9b3 100644 --- a/doc/source/getting_started/10min.rst +++ b/doc/source/getting_started/10min.rst @@ -83,13 +83,6 @@ As you can see, the columns ``A``, ``B``, ``C``, and ``D`` are automatically tab completed. ``E`` is there as well; the rest of the attributes have been truncated for brevity. -.. note:: - Adding a column to a DataFrame is relatively fast. Adding a row, however, - requires a full copy of the data and a construction of a new Index, which - may be expensive. Rather than iteratively building a DataFrame by - appending records, we recommend passing the pre-built list of records - to the DataFrame constructor. See :ref:`Appending to dataframe ` for more. - Viewing data ------------ @@ -475,6 +468,13 @@ Concatenating pandas objects together with :func:`concat`: pd.concat(pieces) +.. note:: + Adding a column to a DataFrame is relatively fast. Adding a row, however, + requires a full copy of the data and a construction of a new Index, which + may be expensive. Rather than iteratively building a DataFrame by + appending records, we recommend passing the pre-built list of records + to the DataFrame constructor. See :ref:`Appending to dataframe ` for more. + Join ~~~~ From 962aae2c510b65fa98da968ecc7446b7c2e7c64a Mon Sep 17 00:00:00 2001 From: Samesh Lakhotia <43701530+sameshl@users.noreply.github.com> Date: Sun, 28 Jul 2019 09:19:53 +0530 Subject: [PATCH 5/7] made the note more consise --- doc/source/getting_started/10min.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/source/getting_started/10min.rst b/doc/source/getting_started/10min.rst index fe9565144b9b3..155899f22c467 100644 --- a/doc/source/getting_started/10min.rst +++ b/doc/source/getting_started/10min.rst @@ -469,12 +469,12 @@ Concatenating pandas objects together with :func:`concat`: pd.concat(pieces) .. note:: - Adding a column to a DataFrame is relatively fast. Adding a row, however, - requires a full copy of the data and a construction of a new Index, which - may be expensive. Rather than iteratively building a DataFrame by - appending records, we recommend passing the pre-built list of records - to the DataFrame constructor. See :ref:`Appending to dataframe ` for more. - + Adding a column to a ``DataFrame`` is relatively fast. However, adding + a row requires a copy, and may be expensive. It is recommended to + pass a pre-built list of records to the ``Dataframe`` constructor instead + of building a ``Dataframe`` by iteratively appending records to it. + See :ref:`Appending to dataframe ` for more. + Join ~~~~ From 9bfec58496ab3b781d4260380b4789f452776126 Mon Sep 17 00:00:00 2001 From: Samesh Lakhotia <43701530+sameshl@users.noreply.github.com> Date: Sun, 28 Jul 2019 19:09:28 +0530 Subject: [PATCH 6/7] remove trailing white spaces --- doc/source/getting_started/10min.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/source/getting_started/10min.rst b/doc/source/getting_started/10min.rst index 155899f22c467..f7b9224cec0ad 100644 --- a/doc/source/getting_started/10min.rst +++ b/doc/source/getting_started/10min.rst @@ -469,12 +469,12 @@ Concatenating pandas objects together with :func:`concat`: pd.concat(pieces) .. note:: - Adding a column to a ``DataFrame`` is relatively fast. However, adding - a row requires a copy, and may be expensive. It is recommended to - pass a pre-built list of records to the ``Dataframe`` constructor instead - of building a ``Dataframe`` by iteratively appending records to it. + Adding a column to a ``DataFrame`` is relatively fast. However, adding + a row requires a copy, and may be expensive. It is recommended to + pass a pre-built list of records to the ``Dataframe`` constructor instead + of building a ``Dataframe`` by iteratively appending records to it. See :ref:`Appending to dataframe ` for more. - + Join ~~~~ From 27455cb127b1c3bd8748d3a299e17baa0498a33a Mon Sep 17 00:00:00 2001 From: Samesh Lakhotia <43701530+sameshl@users.noreply.github.com> Date: Wed, 31 Jul 2019 17:16:07 +0530 Subject: [PATCH 7/7] Minor style changes --- doc/source/getting_started/10min.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/getting_started/10min.rst b/doc/source/getting_started/10min.rst index f7b9224cec0ad..9045e5b32c29f 100644 --- a/doc/source/getting_started/10min.rst +++ b/doc/source/getting_started/10min.rst @@ -470,9 +470,9 @@ Concatenating pandas objects together with :func:`concat`: .. note:: Adding a column to a ``DataFrame`` is relatively fast. However, adding - a row requires a copy, and may be expensive. It is recommended to - pass a pre-built list of records to the ``Dataframe`` constructor instead - of building a ``Dataframe`` by iteratively appending records to it. + a row requires a copy, and may be expensive. We recommend passing a + pre-built list of records to the ``DataFrame`` constructor instead + of building a ``DataFrame`` by iteratively appending records to it. See :ref:`Appending to dataframe ` for more. Join