Ben Chuanlong Du's Blog

It is never too late to learn.

Spark Issue: Pure Python Code Errors

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

This post collects some typical pure Python errors in PySpark applications.

Symptom 1

object has no attribute

Solution 1

Fix the attribute name.

Symptom 2

No such file or directory

Solution …

Profile Performance of Python Applications

Tips

  1. cProfile (implemented in C) is preferred over profile (implemented in Python).

  2. The profiler modules (cProfile and profile) and tools based on them (e.g., %prun and %%prun for notebook) are designed to provide an execution profile for a given program, not for benchmarking purposes (for that, there is time

DataFrame Implementations in Python

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Tips and Traps

Alternatives to pandas for Small Data

  1. Polars is a blazingly fast DataFrames library implemented in Rust using Apache Arrow as memory model. It is the best replacement of pandas for small data at this time. Notice that Polars support multithreading and lazy computation but it cannot handle data larger than memory at this time.

My List of Python Modules

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Awesome Python

Awesome Python Applications

Data Science

  1. pandas: data frame.

  2. scipy: scientific computing.

  3. numpy: multi-dimensional arrays, fundation of pandas and deep learning packages.

  4. re: regular expression

File System

  1. shutil: copy, move …