From f43a10c798d9ba8a3749543ec9b8506d7f718be2 Mon Sep 17 00:00:00 2001 From: isushmeeta Date: Thu, 25 Sep 2025 16:22:53 +0600 Subject: [PATCH 1/2] DOC: add note about DataFrame index in 01-table_oriented --- .../intro_tutorials/01_table_oriented.rst | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/doc/source/getting_started/intro_tutorials/01_table_oriented.rst b/doc/source/getting_started/intro_tutorials/01_table_oriented.rst index 7e86ad6c499d9..bad3e6db81559 100644 --- a/doc/source/getting_started/intro_tutorials/01_table_oriented.rst +++ b/doc/source/getting_started/intro_tutorials/01_table_oriented.rst @@ -26,8 +26,14 @@ documentation. -pandas data table representation +Pandas representation of Data ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. note:: + + Each DataFrame has an *index*, which uniquely identifies each row. + By default, it appears as the leftmost label in the table. + For more about the index, see :ref:`user_guide/indexing`. + .. image:: ../../_static/schemas/01_table_dataframe.svg :align: center @@ -55,7 +61,13 @@ I want to store passenger data of the Titanic. For a number of passengers, I kno df To manually store data in a table, create a ``DataFrame``. When using a Python dictionary of lists, the dictionary keys will be used as column headers and -the values in each list as columns of the ``DataFrame``. +the values in each list as columns of the ``DataFrame``. +.. note:: + + Each DataFrame has an *index*, which uniquely identifies each row. + By default, it appears as the leftmost label in the table. + For more about the index, see :ref:`user_guide/indexing`. + .. raw:: html @@ -70,7 +82,7 @@ SQL table or the ``data.frame`` in `R `__. - The table has 3 columns, each of them with a column label. The column labels are respectively ``Name``, ``Age`` and ``Sex``. - The column ``Name`` consists of textual data with each value a - string, the column ``Age`` are numbers and the column ``Sex`` is + string, the column ``Age`` contains numbers and the column ``Sex`` contains textual data. In spreadsheet software, the table representation of our data would look @@ -220,3 +232,7 @@ A more extended explanation of ``DataFrame`` and ``Series`` is provided in the : .. raw:: html + .. tip:: + + You can select rows by index using ``df.loc[index]`` or ``df.iloc[position]``. + From 85adc01af0f2763f82850bd5d8b93004baab0104 Mon Sep 17 00:00:00 2001 From: isushmeeta Date: Thu, 25 Sep 2025 16:37:22 +0600 Subject: [PATCH 2/2] git commit -m "DOC: add note about DataFrame index and fix minor typo in 01-table_oriented" --- .../getting_started/intro_tutorials/01_table_oriented.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/doc/source/getting_started/intro_tutorials/01_table_oriented.rst b/doc/source/getting_started/intro_tutorials/01_table_oriented.rst index bad3e6db81559..b9bc72e34b8fc 100644 --- a/doc/source/getting_started/intro_tutorials/01_table_oriented.rst +++ b/doc/source/getting_started/intro_tutorials/01_table_oriented.rst @@ -28,12 +28,6 @@ documentation. Pandas representation of Data ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. note:: - - Each DataFrame has an *index*, which uniquely identifies each row. - By default, it appears as the leftmost label in the table. - For more about the index, see :ref:`user_guide/indexing`. - .. image:: ../../_static/schemas/01_table_dataframe.svg :align: center