Two-dimensional-A matrix, i.e., a collection of sequences, all of the same length, arranged into rows or columns One-dimensional-A sequence of values, analogous to a list In this book, we are going to focus on the three most useful types of arrays: By convention, numpy is imported as np:Īn array is an ordered sequence of values, arranged in an n-dimensional structure. Rasterio and richdem for working with rasters (see Rasters (rasterio))Īssuming it is installed (see Installing packages, to start working with numpy we first need to import it (see Loading packages). Geopandas for working with vector layers (see Vector layers (geopandas)) Pandas for working with tables (see Tables (pandas)) numpy is the foundation for many other, more specialized, packages in Python, including most of the packages we learn about later on in this book: Numpy is a core package in the data science ecosystem of Python, so it is worthwhile to learn it no matter what aspect of data science you are going to explore later on. numpy also provides “vectorized” operators for arrays, which otherwise require using for loops (see for loops) or list comprehension (see List comprehension) when working with lists. Namely, thanks to the fact that a numpy array is uniform, in terms of data types, processing is much more efficient compared to a list (see Lists (list)). The numpy package provides standardized data structures, functions, and operators for homogeous arrays, facilitating efficient computation and shorter code. Numpy (short for “numerical python”) is a well-established Python package for scientific computing with arrays, and for working with data in general. Therefore, although the material in this chapter may seem abstract at first, keep in mind that it is going to be practically applicable soon enough through all of the remaining chapters. For example, table (see Tables (pandas)) and vector layer (see Vector layers (geopandas)) columns, as well as rasters (see Rasters (rasterio)), are internally represented by numpy arrays. However, as we will see in later chapters, the numpy package is also the foundation and basis for most data analysis-related domains in Python, inclusing spatial data analysis. In this chapter we work with the numpy package on its own. Plotting (numpy) (using the matplotlib package) ![]() We are going to learn about methods for working with arrays, including: In this chapter we cover our first third-party package, named numpy. Tables can also be thought as a collection of one-dimensional arrays, having the same length, representing the different columns in a table (see Tables (pandas)) For example:ĭigital images and spatial rasters are represented using arrays, possibly with spatial metadata (such as the Coordinate Reference System) (see Rasters (rasterio) and Raster-vector interactions) ![]() ![]() Many types of data are convenient to arrange and represent using arrays, and many types of data processing operations are facilitated through the use of arrays. Arrays are fundamental when working with data.
0 Comments
Leave a Reply. |