6. Importing and Exporting Data
Activity 8: Using an External Dataset to Discover Sales Trends
Solution
- The dataset can be downloaded from GitHub using the link provided. Once you go to the web page, you should be able to Save Page As… using the menus on your browser:
Figure 6.24: Saving the public transportation .csv file
- The simplest way to transfer the data in a CSV file to pandas is to create a new Jupyter notebook. At the command line, type
jupyter notebook
(if you do not have a notebook server running already). In the browser window that pops up, create a new Python 3 notebook. In the first cell, you can type in the standardimport
statements and the connection information (replacingyour_X
with the appropriate parameter for your database connection):from sqlalchemy import create_engine import pandas as pd % matplotlib inline cnxn_string = ("postgresql+psycopg2://{username}:{pswd}" Â Â Â Â Â Â Â Â Â Â ...