I’m trying to join data from two dataframe then show joined dataframe by Dash AG Grid and I have below problem that needs your suggestions:
import dash_ag_grid as dag
from dash import Dash, html, dcc
import pandas as pd
import numpy as np
df = pd.DataFrame({'Definition': ['Loan', 'Deposit'],
'20231015': [28, 17],
'20231016': [5, 6],
'20231017': [10, 13],
'Notes':['','']})
df2 = pd.DataFrame({'BR_CD': ['Hanoi', 'Hochiminh'],
'CUS_NM': ['A', 'B'],
'AMT': ['2', '3']})
df2['Conclusion'] = "[" + df2['BR_CD'] + "]" + ' ' + df2['CUS_NM'] + ' ' + df2['AMT']
x = "[" + df2['BR_CD'] + "]" + ' ' + df2['CUS_NM'] + ' ' + df2['AMT']
df['Notes'].iloc[1] = '\n'.join(x)
app = Dash(__name__)
app.layout = html.Div([
dag.AgGrid(
columnDefs=[{'field':x, 'value':x} for x in df.columns],
rowData=df.to_dict('records'),
columnSize="sizeToFit",
defaultColDef={"editable": True},
)
])
if __name__ == '__main__':
app.run_server(debug=False)
I want [Hochiminh] B 3 will be shown under [Hanoi] A 2. How can I achieve that.
Thank you.