Explain Codes LogoExplain Codes Logo

Python

How do you properly determine the current script directory?

python
pathlib
best-practices
filesystem

Add column to dataframe with constant value

python
dataframe
pandas
best-practices

Extracting specific selected columns to new DataFrame as a copy

python
dataframe
pandas
best-practices

Python list in SQL query as parameter

python
parameterization
sql-injection
sqlalchemy

Open S3 object as a string with Boto3

python
boto3
s3-object
memory-efficient

Get the last 4 characters of a string

python
string-slicing
python-features
substring-extraction

How do I clone a list so it doesn't change unexpectedly after assignment?

python
deepcopy
list-cloning
python-objects

How do you generate dynamic (parameterized) unit tests in Python?

python
pytest
unit-tests
parameterized-tests

Reading binary file and looping over each byte

python
performance
best-practices
memory-handling

How can I rename a conda environment?

python
conda
environment-management
renaming-environment

Django order_by query set, ascending and descending

python
django
queryset
ordering

Generating an MD5 checksum of a file

python
file-io
hashing
performance-benchmarking

Threading pool similar to the multiprocessing Pool?

python
multiprocessing
threading
performance

How do I add an extra column to a NumPy array?

python
numpy
array-manipulation
dataframe

How to retry after exception?

python
retry-mechanisms
exception-handling
resilience

How to find children of nodes using BeautifulSoup

python
node-traversal
beautifulsoup
html-parsing

How to flatten a hierarchical index in columns

python
dataframe
pandas
best-practices

Checking if an element exists with Python Selenium

python
selenium
webdriver
explicit-wait

Check if a key exists in a bucket in S3 using boto3

python
boto3
s3
aws-sdk

How to emulate a do-while loop?

python
state-machines
iteration-handling
error-handling