From a file
The data we want to analyze will most often come from outside Python. In many cases, we may have a data dump from a database or website and have to bring it into Python to sift through it. A data dump gets its name from containing a large amount of data (possibly at a very granular level) and often not discriminating against any of it initially; for this reason, they can often be unwieldy.
Often, these data dumps will come in the form of a text file (.txt) or a CSV file (.csv). Pandas provides many methods to read in different types of files, so it is simply a matter of looking up the one that matches our file format. Our earthquake data is a CSV file; therefore, we use the pd.read_csv() function to read it in. However, we should ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access