Data Files and Character Strings
John M. Essick · 2024
Abstract Readers learn how to use the NumPy library’s file I/O functions to store data in, and read data from, computer files. The commonly used comma-separated values (CSV) spreadsheet format is described and then readers create NumPy-based programs that store and read data in one- and two-dimensional CSV-formatted files. Numeric formatting, escape sequences, and the Unicode character coding scheme are covered. In the Do It Yourself project, readers learn the NumPy-based method for storing and reading data in binary-formatted files, while the Use It! example explores how to store streaming data as it is acquired during runtime in order to prevent data loss in the event of a program crash.