3 Importing and exporting data

 

So far, we’ve been creating data frames manually or using random values. In the real world, data frames contain actual, useful values, typically imported from CSV files, Excel spreadsheets, or relational databases. Similarly, when we’re done analyzing data, we want to share our analysis by saving data to files in those (or other) formats.

In this chapter, we explore how to import data from various formats, emphasizing CSV files because they’re so common. We look at ways in which we can not only read from such files but also customize the reading either to improve the quality of our data or optimize the process.

Exercise 15 Weird taxi rides

Working it out

Solution

Beyond the exercise

Exercise 16 Pandemic taxis

Working it out

Solution

Beyond the exercise

Exercise 17 Setting column types

Working it out

Beyond the exercise

Exercise 18 passwd to df

Working it out

Solution

Beyond the exercise

Exercise 19 Bitcoin values

Working it out

Solution

Beyond the exercise

Exercise 20 Big cities

Working it out

Solution