O'Reilly logo

Learning pandas - Second Edition by Michael Heydt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling variants of formats in field-delimited data

Data in a field-delimited file may contain extraneous headers and footers. Examples include company information at the top, such as an invoice number, addresses, and summary footers. There are also cases where data is stored on every other line. These situations will cause errors when loading data like this. To handle these scenarios, the pandas pd.read_csv() and pd.read_table() methods have some useful parameters to help us out.

To demonstrate, take the following variation on the MSFT stock data, which has extra rows of what can be referred to as noise information:

This situation can be ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required