Book Image

Learning NumPy Array

By : Ivan Idris
Book Image

Learning NumPy Array

By: Ivan Idris

Overview of this book

Table of Contents (14 chapters)
Learning NumPy Array
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Introducing the dataset


First, we will learn about file I/O with NumPy. Data is usually stored in files. You would not get far if you are not able to read from and write to files.

The Royal Netherlands Meteorological Institute (KNMI) offers daily weather data online (browse to http://www.knmi.nl/climatology/daily_data/download.html). KNMI is the Dutch meteorological service headquartered in De Bilt. Let's download one of the KNMI files from the De Bilt weather station. The file is roughly 10 megabytes. It has some text with explanation about the data in Dutch and English. Below that is the data in comma-separated values format. I separated the metadata and the actual data into separate files. The separation is not necessary because you can skip rows when loading from NumPy. I wrote a simple script with NumPy to determine the maximum and minimum temperature for the dataset from a CSV file that was created in the separation process.

The temperatures are given in tenths of a degree Celsius. There...