Object of Type int64 Is Not JSON Serializable
NumPy and pandas numbers are not Python numbers, and json.dumps refuses them. Here are four fixes, from a one-line conversion to a…
Try: python lists, javascript functions, syntax error, first project
Plain-English Python guides, from installing it to writing small programs that do real work. Short examples you can copy, run and change.
40 guides
NumPy and pandas numbers are not Python numbers, and json.dumps refuses them. Here are four fixes, from a one-line conversion to a…
Python runs from a normal terminal but not inside VS Code, or the wrong version runs, or packages are missing? The editor…
Nearly always the wrong interpreter, not a missing package. Here is the two-command diagnosis and the fix for venv, conda, VS Code,…
What __new__ does, how it differs from __init__, and the three cases where you genuinely need it: singletons, immutable subclasses and instance…
The MySQL connector is not installed in the Python you are running. Here is how to install the right package, check which…
The five TypeErrors dictionaries throw — unhashable type, not subscriptable, not callable, missing arguments and unsupported operand — and the fix for…
This error means your shell has not been set up for conda. Here is what conda init does, why it is needed,…
This error means a library is calling a NumPy alias that was removed in NumPy 1.24. Here is how to identify which…
How if, elif and else work in Python, what counts as true, and the six mistakes that trip beginners up — colons,…
How to scrape a web page with Python responsibly: requests and BeautifulSoup, reading robots.txt, rate limiting, and when to use an API…
RecursionError means your function called itself too many times. Here is how to find the missing base case, when to raise the…
How to check whether a key exists in a Python dictionary, why the in operator beats has_key and try/except, and when .get()…
Related topics
The fastest way to improve is to read one guide, then build the thing it describes. Start with the basics, or jump straight to a project.