Fast and easy data loading

Let's start with a CSV file and pandas. The pandas library offers the most accessible and complete functionality to load tabular data from a file (or a URL). By default, it will store data in a specialized pandas data structure, index each row, separate variables by custom delimiters, infer the right data type for each column, convert data (if necessary), as well as parse dates, missing values, and erroneous values.

We will start by importing the pandas package and reading our Iris dataset:

In: import pandas as pd    iris_filename = 'datasets-uci-iris.csv'    iris = pd.read_csv(iris_filename, sep=',', decimal='.', header=None,                       names= ['sepal_length', 'sepal_width',                                'petal_length', 'petal_width',                               'target'])

You can specify ...

Get Python Data Science Essentials - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.