Explain Codes LogoExplain Codes Logo

Python

Writing a Python list of lists to a CSV file

python
csv-writing
pandas
data-structures

Why is the empty dictionary a dangerous default value in Python?

python
mutable-defaults
function-calls
defensive-programming

Why do I need 'b' to encode a string with Base64?

python
base64-encoding
unicode-strings
bytes-literals

Why do I get AttributeError: 'NoneType' object has no attribute 'something'?

python
attributeerror
error-handling
best-practices

Why does "pip install" inside Python raise a SyntaxError?

python
pip-install
python-interpretter
subprocess-module

Why doesn't Python have a sign function?

python
custom-functions
edge-cases
math-standards

Whether to use apply vs transform on a group object, to subtract two columns and get mean

python
dataframe
pandas
apply-vs-transform

Where do the Python unit tests go?

python
test-organization
pytest
unit-tests

What is the syntax to insert one list into another list in Python?

python
list-insertion
python-lists
list-merging

What is the standard way to add N seconds to datetime.time in Python?

python
timedelta
datetime
dateutil

What is the right way to treat Python argparse.Namespace() as a dictionary?

python
namespace
argparse
dictionary

What is the purpose of the "send" function on Python generators?

python
coroutines
asynchronous-programming
generators

What is the proper way to comment functions in Python?

python
docstrings
best-practices
python-standards

What is the most efficient way of finding all the factors of a number in Python?

python
micro-optimization
generators
performance-tuning

What is the difference between Python's list methods append and extend?

python
list-methods
append-vs-extend
python-lists

What is the difference between Jupyter Notebook and JupyterLab?

python
jupyterlab
jupyter-notebook
data-science

What is PEP8's E128: continuation line under-indented for visual indent?

python
indentation
pep8
code-style

What is & How to use getattr() in Python?

python
getattr
setattr
hasattr

What does "SyntaxError: Missing parentheses in call to 'print'" mean in Python?

python
python-3
print-function
python-2-to-python-3

What does if __name__ == "__main__": do?

python
best-practices
maintainability
readability