How-to articles, tricks, and solutions about PYTHON
Understanding Python super() with __init__() methods
The super() function is a way to refer to the parent class and its attributes.
UnicodeDecodeError: 'charmap' codec can't decode byte X in position Y: character maps to <undefined>
Unzipping files in Python
Here is a code snippet that demonstrates how to unzip a file using the zipfile module in Python:
Use a list of values to select rows from a Pandas dataframe
You can use the .loc property of a Pandas dataframe to select rows based on a list of values.
Use different Python version with virtualenv
To use a different Python version with virtualenv, follow these steps:
ValueError: setting an array element with a sequence
This code creates a 2D numpy array, and then tries to set the first element of the array to a list.