Week 7 • Wednesday

Block 65: Flask: Serving Data from pandas

Connect Flask to a pandas dataset and serve computed results.

Concepts

Code Examples

See exercise below.

Exercise

Build a Flask app that loads the Iris dataset and serves: /data (JSON all), /stats (JSON describe), /species/<name> (filtered rows). Render a simple HTML table of the first 10 rows via a template.

Homework

What is the risk of using a global DataFrame in Flask? How could you improve this?