Python Leftovers
-
Pandas Argmax()
Guide on how to locate the index location of the maximum value in a DataFrame or Series using the Index.argmax(), Series.argmax, and DataFrame[‘column’].argmax.
-
Pandas Add Days to Date
Practical guide on how to add the days to the dates in Pandas by utilizing three methods – pandas.DateOffset(), pandas.timeDelta(), and pandas.to_timeDelta().
-
A per-interpreter GIL
"Subinterpreters", which are separate Python interpreters running in the same process that can be created using the C API, have been a part of Python since the previous century (version 1.5 in 1997), but they are largely unknown and unused. Eric Snow has been on something of a quest, since 2015 or so, to bring better multicore processing to Python by way of subinterpreters (or "multiple interpreters"). He has made it part of the way there, with the adoption of a separate global interpreter lock (GIL) for each subinterpreter, which was added for Python 3.12. Back in April, Snow gave a talk (YouTube video) at PyCon about multiple interpreters, their status, and his plans for the feature in the future.
We have looked in on the subinterpreter work a few times along the way; beyond the article when Snow started his quest, he presented a status update at the 2018 Python Language Summit and there were some further discussions back in 2020. On April 7, 2023, two weeks before Snow gave his talk, the steering council accepted PEP 684 ("A Per-Interpreter GIL") for inclusion into Python 3.12.