O'Reilly logo

NumPy Cookbook - Second Edition by Ivan Idris

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

Loading data as pandas objects from statsmodels

statsmodels has quite a lot of sample datasets in its distribution. The complete list can be found at https://github.com/statsmodels/statsmodels/tree/master/statsmodels/datasets.

In this tutorial, we will concentrate on the copper dataset, which contains information about copper prices, world consumption, and other parameters.

Getting ready

Before we start, we might need to install patsy. patsy is a library that describes statistical models. It is easy enough to see whether this library is necessary; just run the code. If you get errors related to patsy, execute any one of the following commands:

$ sudo easy_install patsy
$ pip install --upgrade patsy

How to do it...

In this section, we will load a dataset ...

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