Skip to content

Python

Python syntax and standard libraries through testing, automation, data processing, and service implementation.

Articles

22 total

pandas read_csv UnicodeDecodeError: Check UTF-8 vs. CP949

Identify a CSV file’s byte encoding before choosing encoding="cp949", then verify decoded headers and sample values.

Python3 min

pandas loc vs. iloc: Why the First Filtered Row Raises KeyError

After filtering a DataFrame, distinguish its retained index labels from current row positions before reading the first row.

Python3 min

pandas groupby count vs. size: Why Missing Wait Times Change the Total

Compare received rows with non-null wait-time measurements in the same five-row dataset, including a valid zero-minute wait.

Python3 min

Why Python range() Excludes the Stop Value: Numbering Items Correctly

See why range(1, 4) produces 1, 2, 3, and avoid off-by-one errors when numbering files or indexing a list.

Python2 min

Why a List Inside an Immutable Python Tuple Can Still Change

Compare a failed tuple item assignment with a successful append to the contained list, and see what a snapshot or dictionary key requires.

Python3 min

pandas missing values: Check before choosing dropna or fillna

Inspect missing-value counts and rates with isna, then compare how dropna and fillna change rows, data types, and analytical meaning.

Python3 min

Why pandas merge Creates Extra Rows: Duplicate Keys and Join Cardinality

Trace how duplicate join keys multiply rows and use the validate option to check the relationship you expect.

Python2 min

Python JSON missing key: When to use dict brackets, get, or validation

Treat required and optional API response keys differently, distinguish a missing value from zero, and test validation errors.

Python3 min

BeautifulSoup select_one() Returns None: Check Selectors Safely

Handle a missing element explicitly and distinguish a changed CSS selector, absent data, and HTML that differs from the browser view.

Python2 min