Introduction to NumPy

Summary

This course has covered:

  • NumPy arrays and how to select and manipulate them
  • Creating NumPy arrays with built-in functions
  • Performing mathematical and logical operations on NumPy arrays
  • Dealing with multiple dimensions
  • Combining arrays when they are not exactly the same shape
  • Plotting data from NumPy arrays

Further reading

If you want more details on NumPy then have a look at the official absolute beginner's guide or, in more depth, the quickstart.

For a course which details how you can use NumPy to perform simulations, have a look at our Numpy and Simulations course.

If you want to learn how NumPy can be combined with other tools to make your code run very efficiently, see our Accelerating Python course.

Other tools

NumPy is the foundation of a lot of the numerical and scientific tools in Python but it not always the right tool for the job:

  • for tabular or columnar data you should use pandas which allows you to quickly filter and plot these types of data,
  • for complex multi-dimensional data, particularly geographical data the best tool is xarray,
  • for simpler two-dimensional geographical data there is geopandas and related tools.

Credits

This course was written by Matt Williams. All text is published under a Creative Commons Attribution 4.0 International License with all code snippets licensed as MIT.

The source for the material can be found on GitLab where fixes are welcome.

All multi-dimensional weather data is © European Centre for Medium-Range Weather Forecasts (ECMWF) Source: www.ecmwf.int Licence: CC-BY-4.0 and ECMWF Terms of Use (https://apps.ecmwf.int/datasets/licences/general/)