How-to articles, tricks, and solutions about PYTHON
What is the difference between range and xrange functions in Python 2.X?
In Python 2.X, range and xrange are used to generate a sequence of numbers.
How do I update/upgrade pip itself from inside my virtual environment?
To update pip itself from inside your virtual environment, you can use the following command:
Create an empty list with certain size in Python
You can create an empty list of a certain size in Python using the following methods:
What is the purpose and use of **kwargs?
In Python, kwargs is a way to pass a keyworded, variable-length argument list.
Pandas Merging 101
Here is an example of how to use the pd.merge() function to merge two DataFrames in pandas:
How can I iterate over files in a given directory?
You can use the os module in Python to iterate over files in a given directory.
How do I get the day of week given a date?
You can use the datetime module in Python to get the day of the week for a given date.
How do I parse an ISO 8601-formatted date?
You can use the datetime.fromisoformat() method to parse an ISO 8601-formatted date in Python.
What does the "at" (@) symbol do in Python?
In Python, the "at" (@) symbol is used to decorate a function.
Python: Find in list
Here is a code snippet that demonstrates how to find an element in a list in Python:
How to define a two-dimensional array?
A two-dimensional array in Python can be defined using the numpy library.