file IO

Read and write files from code: text and binary, reading lines, copying, temp files, and streams, with tested examples and real output.

Pandas Introduction: Series, DataFrame, Reading Data

This pandas introduction gets you started fast: create Series and DataFrames, read CSV, Excel, and JSON files, inspect data with head, info, and describe, and run your first data analysis in minutes. “If you torture the data long enough, it will confess to anything.” Ronald Coase Last Updated: July 2026 | Tested on: Python 3.14.6, Pandas 3.0.3 | Difficulty: Intermediate | Reading Time: 16 minutes You have a spreadsheet of sales numbers. You want the total per city, the rows ... Read More

Python: REST APIs with requests, Authentication, Pagination

You need a list of users from another service, so you open a browser and copy the data by hand. That works exactly once. It falls apart the moment you need it every hour, for 50 cities, saved to a file. The Python requests library is how you stop: send an HTTP call from code and get back clean JSON. This post covers GET through DELETE, API keys and bearer tokens, pagination, and surviving timeouts and flaky servers. “An API ... Read More

Python: Pydantic, Data Validation, Settings, Serialization

You wrote a clean API endpoint and it worked on your machine. Then someone sent "age": "twenty-eight" in a JSON body, your code did math on a string, and the request blew up three functions deep. The Python Pydantic library stops that at the door: v2 checks every field as data arrives, coerces "42" into a real 42, and raises one clear error naming the exact bad field. “There are two ways of constructing a software design: one way is ... Read More