Skip to content

DOC: Clarifying brackets vs. parentheses #57236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/source/getting_started/intro_tutorials/02_read_write.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ in this ``DataFrame`` are integers (``int64``), floats (``float64``) and
strings (``object``).

.. note::
When asking for the ``dtypes``, no brackets are used!
When asking for the ``dtypes``, no parentheses ``()`` are used!
``dtypes`` is an attribute of a ``DataFrame`` and ``Series``. Attributes
of a ``DataFrame`` or ``Series`` do not need brackets. Attributes
of a ``DataFrame`` or ``Series`` do not need ``()``. Attributes
represent a characteristic of a ``DataFrame``/``Series``, whereas
methods (which require brackets) *do* something with the
methods (which require parentheses ``()``) *do* something with the
``DataFrame``/``Series`` as introduced in the :ref:`first tutorial <10min_tut_01_tableoriented>`.

.. raw:: html
Expand Down
4 changes: 2 additions & 2 deletions doc/source/getting_started/intro_tutorials/03_subset_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ selection brackets ``[]``.
.. note::
The inner square brackets define a
:ref:`Python list <python:tut-morelists>` with column names, whereas
the outer brackets are used to select the data from a pandas
the outer square brackets are used to select the data from a pandas
``DataFrame`` as seen in the previous example.

The returned data type is a pandas DataFrame:
Expand Down Expand Up @@ -354,7 +354,7 @@ See the user guide section on :ref:`different choices for indexing <indexing.cho
<h4>REMEMBER</h4>

- When selecting subsets of data, square brackets ``[]`` are used.
- Inside these brackets, you can use a single column/row label, a list
- Inside these square brackets, you can use a single column/row label, a list
of column/row labels, a slice of labels, a conditional expression or
a colon.
- Select specific rows and/or columns using ``loc`` when using the row
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ hPa, the conversion factor is 1.882*)
air_quality["london_mg_per_cubic"] = air_quality["station_london"] * 1.882
air_quality.head()

To create a new column, use the ``[]`` brackets with the new column name
To create a new column, use the square brackets ``[]`` with the new column name
at the left side of the assignment.

.. raw:: html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ columns by passing ``numeric_only=True``:

It does not make much sense to get the average value of the ``Pclass``.
If we are only interested in the average age for each gender, the
selection of columns (rectangular brackets ``[]`` as usual) is supported
selection of columns (square brackets ``[]`` as usual) is supported
on the grouped data as well:

.. ipython:: python
Expand Down