Hello,
Using this as my base https://vanguard-report.herokuapp.com/dash-vanguard-report
I’m trying to populate the “Fast Facts” table from the database, rather than a CSV.
I’ve been able to print out my Dataframe (originally a dictionary) to terminal and it looks similar to the format of the CSV but i cant get my keys into column 1 or the table ever
Please help
html.H4('Database DataTable 3'),
db_table3()
])
I’m pretty confident
def db_table3():
sql_conn = connectSQLServer()
cursor = sql_conn.cursor(as_dict=True)
cursor.execute("SELECT * FROM [dbo].[Portfolio] WHERE PortfolioCode = 'G003'")
data = cursor.fetchall()
data_series = pd.Series(data[0], index=data[0])
print(data_series)
print(data)
return make_dash_table(data_series)
```
print of data_series
PortfolioCode G003
AssetClass1 Bonds
AssetClass2 Global Credit
Style Smart Beta Plus (SBP)
ManagementFee 0.65
BuySellSpread 0.15
InceptionDate 2010-03-11 00:00:00
Currency AUD
print of data
[{'PortfolioCode': 'G003', 'AssetClass1': 'Bonds', 'AssetClass2': 'Global Credit', 'Style': 'Smart Beta Plus (SBP)', 'ManagementFee': Decimal('0.65'), 'BuySellSpread': Decimal('0.15'), 'InceptionDate': datetime.datetime(2010, 3, 11, 0, 0), 'Currency': 'AUD'}]
