In this tutorial, we will learn how to skip rows during csv import with Python Pandas. To skip rows during csv import with Python Pandas, we can call read_csv
with the skiprows
argument.
import pandas as pd
from StringIO import StringIO
s = """1, 2
3, 4
5, 6"""
df = pd.read_csv(StringIO(s), skiprows=[1], header=None)
skiprows
to [1]
to skip the 2nd row.header
to None
to skip parsing the header.