From 25f377eeec92d3029a79b399d48b7a012ce5e1ab Mon Sep 17 00:00:00 2001 From: shriyakalakata Date: Tue, 26 Mar 2024 15:17:24 -0400 Subject: [PATCH 1/5] docs: Add note about exception for integer slices with float indices --- doc/source/user_guide/indexing.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/source/user_guide/indexing.rst b/doc/source/user_guide/indexing.rst index 24cdbad41fe60..fcf391ef8b171 100644 --- a/doc/source/user_guide/indexing.rst +++ b/doc/source/user_guide/indexing.rst @@ -262,6 +262,9 @@ The most robust and consistent way of slicing ranges along arbitrary axes is described in the :ref:`Selection by Position ` section detailing the ``.iloc`` method. For now, we explain the semantics of slicing using the ``[]`` operator. +However, there is an exception to this rule when the Series has float indices. +In such cases, integer slices behave more the ``.iloc`` method + With Series, the syntax works exactly as with an ndarray, returning a slice of the values and the corresponding labels: From ad2eae5e9a7bed1ca8b900aae61bc997133d691b Mon Sep 17 00:00:00 2001 From: shriyakalakata Date: Tue, 26 Mar 2024 15:24:44 -0400 Subject: [PATCH 2/5] Remove whitespace --- doc/source/user_guide/indexing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/user_guide/indexing.rst b/doc/source/user_guide/indexing.rst index fcf391ef8b171..448a560d959f8 100644 --- a/doc/source/user_guide/indexing.rst +++ b/doc/source/user_guide/indexing.rst @@ -262,7 +262,7 @@ The most robust and consistent way of slicing ranges along arbitrary axes is described in the :ref:`Selection by Position ` section detailing the ``.iloc`` method. For now, we explain the semantics of slicing using the ``[]`` operator. -However, there is an exception to this rule when the Series has float indices. +However, there is an exception to this rule when the Series has float indices. In such cases, integer slices behave more the ``.iloc`` method With Series, the syntax works exactly as with an ndarray, returning a slice of From 7e4b3c10344ec0f5f6b64d49f3aacbc0a2dcf39f Mon Sep 17 00:00:00 2001 From: shriyakalakata <87483933+shriyakalakata@users.noreply.github.com> Date: Mon, 1 Apr 2024 14:37:33 -0400 Subject: [PATCH 3/5] Update doc/source/user_guide/indexing.rst Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> --- doc/source/user_guide/indexing.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/source/user_guide/indexing.rst b/doc/source/user_guide/indexing.rst index 448a560d959f8..1c0faa75fe6d7 100644 --- a/doc/source/user_guide/indexing.rst +++ b/doc/source/user_guide/indexing.rst @@ -262,8 +262,9 @@ The most robust and consistent way of slicing ranges along arbitrary axes is described in the :ref:`Selection by Position ` section detailing the ``.iloc`` method. For now, we explain the semantics of slicing using the ``[]`` operator. -However, there is an exception to this rule when the Series has float indices. -In such cases, integer slices behave more the ``.iloc`` method + .. note:: + + When the :class:`Series` has float indices, slicing will select by position. With Series, the syntax works exactly as with an ndarray, returning a slice of the values and the corresponding labels: From a760ae5558f8018714fb619fad9424717c1ff47d Mon Sep 17 00:00:00 2001 From: shriyakalakata <87483933+shriyakalakata@users.noreply.github.com> Date: Mon, 1 Apr 2024 16:06:55 -0400 Subject: [PATCH 4/5] Remove trailing whitespace --- doc/source/user_guide/indexing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/user_guide/indexing.rst b/doc/source/user_guide/indexing.rst index 1c0faa75fe6d7..dd588af008b95 100644 --- a/doc/source/user_guide/indexing.rst +++ b/doc/source/user_guide/indexing.rst @@ -264,7 +264,7 @@ detailing the ``.iloc`` method. For now, we explain the semantics of slicing usi .. note:: - When the :class:`Series` has float indices, slicing will select by position. + When the :class:`Series` has float indices, slicing will select by position. With Series, the syntax works exactly as with an ndarray, returning a slice of the values and the corresponding labels: From 1e4050495a0552dc627bada9f16c3260062f65d0 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Mon, 1 Apr 2024 13:40:27 -0700 Subject: [PATCH 5/5] Update doc/source/user_guide/indexing.rst --- doc/source/user_guide/indexing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/user_guide/indexing.rst b/doc/source/user_guide/indexing.rst index dd588af008b95..fd843ca68a60b 100644 --- a/doc/source/user_guide/indexing.rst +++ b/doc/source/user_guide/indexing.rst @@ -263,7 +263,7 @@ described in the :ref:`Selection by Position ` section detailing the ``.iloc`` method. For now, we explain the semantics of slicing using the ``[]`` operator. .. note:: - + When the :class:`Series` has float indices, slicing will select by position. With Series, the syntax works exactly as with an ndarray, returning a slice of