SQLAlchemy en pandas voor visualisatie

Introductie tot databases in Python

Jason Myers

Co-Author of Essential SQLAlchemy and Software Engineer

SQLAlchemy en pandas

  • DataFrame kan een SQLAlchemy-ResultSet aannemen
  • Stel de DataFrame-kolommen in op de ResultSet-keys
Introductie tot databases in Python

DataFrame-voorbeeld

import pandas as pd

df = pd.DataFrame(results)
df.columns = results[0].keys()
print(df)
    sex  pop2008_sum
0     F      2105442
1     F      2087705
2     F      2037280
3     F      2012742
4     F      2014825
5     F      1991082
Introductie tot databases in Python

Grafieken maken

  • We kunnen grafieken maken zoals normaal
Introductie tot databases in Python

Voorbeeld grafiek

import matplotlib.pyplot as plt
df[10:20].plot.barh()
plt.show()

Staafdiagram

Introductie tot databases in Python

Laten we oefenen!

Introductie tot databases in Python

Preparing Video For Download...