Practical guides ↗

Python · Data preparation

Take a first look at your CSV

Inspect columns and missing-value counts with Python and pandas.

3 min readScope: Python / pandas

Try it in three steps

  1. Use a Python environment with pandas installed. Place a comma-separated veri.csv file in the working folder and run import pandas as pd.
  2. Load it with df = pd.read_csv("veri.csv"); inspect initial rows with print(df.head()) and column types and non-null counts with df.info().
  3. Run print(df.isna().sum()) to count recognized missing values per column. Compare the missing-value coding with your data dictionary.

How to read the output

For example, 2 for a column named yas means two observations were recognized as missing; it does not explain why.

Test your understanding.

True or false?

Counting missing values also explains why they are missing.

Related concepts

Official source

Python · Documentation ↗

Documentation checked: . Steps are based on official documentation and have not been tested in the application. Menu names may differ by version and interface language.