Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
aa0804f
DOC: Clarify parentheses vs. brackets usage (GH#62314)
AnandMukherjee2004 Sep 15, 2025
ada92d7
DOC: Clarify parentheses vs. brackets usage (GH#62314) updated
AnandMukherjee2004 Sep 16, 2025
41272b9
DOC: Clarify parentheses vs. brackets usage (GH#62314) updated
AnandMukherjee2004 Sep 16, 2025
8c77d05
DOC: Clarify parentheses vs. brackets usage (GH#62314) updated
AnandMukherjee2004 Sep 16, 2025
fac8e7c
DOC: Clarify parentheses vs. brackets usage (GH#62314) updated
AnandMukherjee2004 Sep 16, 2025
689b069
DOC: Fix trailing whitespace and end-of-file issues (pre-commit CI)
AnandMukherjee2004 Sep 16, 2025
a1feaab
DOC: Fix trailing whitespace and end-of-file issues (pre-commit CI)
AnandMukherjee2004 Sep 16, 2025
2c658b1
DOC: Fix trailing whitespace and end-of-file issues (pre-commit CI)
AnandMukherjee2004 Sep 16, 2025
cf1e395
DOC: Fix trailing whitespace and end-of-file issues (pre-commit CI)
AnandMukherjee2004 Sep 16, 2025
0aa476a
DOC: Changed 03_subset_data.rst
AnandMukherjee2004 Sep 17, 2025
b04d3a4
warning resolved
AnandMukherjee2004 Sep 17, 2025
6c81346
ci precommit
AnandMukherjee2004 Sep 17, 2025
2ed7630
ci precommit
AnandMukherjee2004 Sep 17, 2025
10eb9aa
Merge branch 'main' into doc/clarify-parentheses-vs-brackets-62314
AnandMukherjee2004 Sep 17, 2025
6aeeabd
ci precommit
AnandMukherjee2004 Sep 17, 2025
27ff2d2
Merge branch 'doc/clarify-parentheses-vs-brackets-62314' of https://g…
AnandMukherjee2004 Sep 17, 2025
08f3efd
ci precommit
AnandMukherjee2004 Sep 17, 2025
0fc545c
ci precommit
AnandMukherjee2004 Sep 17, 2025
196a133
remove accidentally committed package-lock.json
AnandMukherjee2004 Sep 19, 2025
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
43 changes: 43 additions & 0 deletions doc/source/getting_started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,49 @@ Data sets often contain more than just numerical data. pandas provides a wide ra

:ref:`To user guide <text>`

.. raw:: html

</span>
</div>
</div>
</div>
</div>

<div class="card tutorial-card">
<div class="card-header collapsed card-link" data-bs-toggle="collapse" data-bs-target="#collapseEleven">
<div class="d-flex flex-row tutorial-card-header-1">
<div class="d-flex flex-row tutorial-card-header-2">
<button class="btn btn-dark btn-sm"></button>
How to use parentheses vs square brackets?
</div>
<span class="badge gs-badge-link">

:ref:`Straight to tutorial...<10min_tut_11_brackets_vs_parenthesis>`

.. raw:: html

</span>
</div>
</div>
<div id="collapseEleven" class="collapse" data-parent="#accordion">
<div class="card-body">

Understanding the difference between parentheses and square brackets is crucial for pandas users. Parentheses are used for function calls and grouping, while square brackets are for indexing and selection.

.. raw:: html

<div class="d-flex flex-row">
<span class="badge gs-badge-link">

:ref:`To introduction tutorial <10min_tut_11_brackets_vs_parenthesis>`

.. raw:: html

</span>
<span class="badge gs-badge-link">

:ref:`To user guide <indexing>`

.. raw:: html

</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _10min_tut_11_brackets_vs_parenthesis:

Parentheses vs. Square Brackets in Python and pandas
====================================================

In both Python and pandas, it is important to understand the difference between parentheses ``()`` and square brackets ``[]``:

- **Parentheses** are used to call functions and methods. For example, ``df.mean()`` calculates the mean of a DataFrame. Parentheses are also used to group expressions, such as ``(a + b) * c``, or to create tuples: ``(1, 2, 3)``.
- **Square brackets** are used for indexing, selecting data, and defining lists. In pandas, you use square brackets to select columns or filter data—for instance, ``df['A']`` selects column ``A``, while ``df[0:3]`` selects rows by position. In standard Python, square brackets are also used to define a list, as in ``my_list = [1, 2, 3]``.

Remember: Use ``[]`` for selection or indexing, and ``()`` for calling functions or grouping expressions.

For more explanation, see `Brackets in Python and pandas <https://python-public-policy.afeld.me/en/columbia/brackets.html>`__.
1 change: 1 addition & 0 deletions doc/source/getting_started/intro_tutorials/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ Getting started tutorials
08_combine_dataframes
09_timeseries
10_text_data
11_brackets_vs_parenthesis
6 changes: 6 additions & 0 deletions package-lock.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove this?

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading