From the course: Python Data Analysis

Unlock the full course today

Join today to access over 24,500 courses taught by industry experts.

Special arrays: Records and dates

Special arrays: Records and dates - Python Tutorial

From the course: Python Data Analysis

Special arrays: Records and dates

- [Instructor] In the last video for this chapter, I want to show you two NumPy features that are not always covered in tutorials but are still very useful. The first is record arrays, which allow us to mix different data types and give descriptive names to fields. We see a much more powerful version of this in the Pandas library, but sometimes it's good to use it within NumPy. The other feature is datetime objects, which as the name says, can encode a date and a time. I will load a simple example of a record array, which I have saved in the NumPy format. This is a partial David Bowie discography. Each entry shows a record's name, date of release, and top rank in the UK charts. The data type is a list, which shows the name and D type of each field. For title, it's U32, which denotes a Unicode string of length 32. For release date, it's M8D, which denotes a NumPy datetime object with the precision of a day. There's an eight because the datetime objects are eight bytes. Finally, the top…

Contents