Pass keyword args to the Python Rich console upon creation for consistent styling:
Have a long Python string , and want to display it nicely? With Rich’s console, you can set the width or justification:
The “console” object in Python Rich lets you separate formatting from the text:
Want to set an option in Python Pandas, but just temporarily? You can use option_context: Within the “with” block, the display precision is 2. But outside — before or after — it is the default.
There are tons of config options in Python Pandas. Set them with pd.set_option: Now floats in a series or data frame will have 2 digits after the decimal. Retrieve the value with “get_option”:
Reading a CSV into a Python Pandas data frame? Before version 3.1, loading CSV was single-threaded and slow. My test file took 1.03s. In 3.1, it’s now multi-threaded and much faster, taking 252 ms. However, it’s still far slower than PyArrow, which took 25.5 ms.
Starting with Python Pandas 3.1, use “filter” to apply a condition to rows. So: can now be (the much slower):
Want to retrieve specific columns from your Python Pandas data frame? In the past, you would say But now, with version 3.1, you can use the “select” method:
The comprehension-unpacking syntax in Python 3.15 is great, but you cannot transform the unpacked elements. Given: [[10, 20, 30], [40, 50, 60], [70, 80]] We can get the individual numbers, but cannot run str on each. For that, we still need a nested comprehension.
In Python 3.15, get the unique elements in a list of iterables with the new in-comprehension unpacking syntax to create a set comprehension: {*n for n in x} # returns {10, 20, 30, 40, 50, 60}