From the course: Advanced Python: Practical Database Examples
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Solution: Ingest data and visualize it using Matplotlib - Python Tutorial
From the course: Advanced Python: Practical Database Examples
Solution: Ingest data and visualize it using Matplotlib
(bright music) - [Instructor] Let's practice ingesting data from a database in Jupyter Notebook. We'll start by importing SQLAlchemy. SQLAlchemy will help us connect to the database. To connect to the SQLite database, we'll create an engine. The input will be our SQLite file with our data in it. That's sqlite:///landon.sqlite. We'll ingest the data with pandas. And we need as pd so we can reference it as pd in our file. To read in the table we'll use the read_sql_table function and pass in our table name along with a few other inputs. These include the connection and the index column. Order_id will act as our primary key, so that's why we set it in our index column. Let's visualize the data. We can sort the order totals and view them with the sort_values function. We'll use that on the data frame. We'll sort the values by order total. It looks like one of the smallest orders was $3 and the largest for $900. We can also…
Contents
-
-
-
-
Introduction to pandas2m 12s
-
(Locked)
Set up pandas and Jupyter Notebook2m 10s
-
(Locked)
Analyze data with pandas3m 30s
-
(Locked)
Analyze data with Matplotlib1m 29s
-
(Locked)
Connect to a DB using SQLAlchemy within Juypter Notebook2m 33s
-
(Locked)
Visualize data using SQLAlchemy, pandas, and Matplotlib3m 30s
-
(Locked)
Challenge: Ingest data and visualize it with Matplotlib1m 7s
-
(Locked)
Solution: Ingest data and visualize it using Matplotlib4m 9s
-
-
-