Skip to content

Commit cf1e395

Browse files
DOC: Fix trailing whitespace and end-of-file issues (pre-commit CI)
1 parent 2c658b1 commit cf1e395

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
.. _10min_tut_11_brackets_vs_parenthesis:\n\nParentheses vs. Square Brackets in Python and pandas\n====================================================\n\nIn both Python and pandas, it is important to understand the difference between parentheses ``()`` and square brackets ``[]``:\n\n- **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)``.\n- **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]``.\n\n\n**Remember :**\nUse ``[]`` for selection or indexing, and ``()`` for calling functions or grouping expressions.\n\nFor more explanation, see `Brackets in Python and pandas <https://python-public-policy.afeld.me/en/columbia/brackets.html>`__.\n
1+
.. _10min_tut_11_brackets_vs_parenthesis:
2+
3+
Parentheses vs. Square Brackets in Python and pandas
4+
====================================================
5+
6+
In both Python and pandas, it is important to understand the difference between parentheses ``()`` and square brackets ``[]``:
7+
8+
- **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)``.
9+
- **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]``.
10+
11+
Remember: Use ``[]`` for selection or indexing, and ``()`` for calling functions or grouping expressions.
12+
13+
For more explanation, see `Brackets in Python and pandas <https://python-public-policy.afeld.me/en/columbia/brackets.html>`__.

0 commit comments

Comments
 (0)