D
D
DEUS92019-06-10 09:42:38
Python
DEUS9, 2019-06-10 09:42:38

How to pass multiple pandas.dataframe in one variable?

I use pdf_reports to generate pdf .

data_frames = pandas.DataFrame.from_records({
                        "NAME": name,
                        "DAY": day,
                        "MONTH": month,
                        "YEAR": year
                    },
                        columns=["NAME", "DAY", "MONTH", "YEAR"])
data_frames2 = pandas.DataFrame.from_records({
                        "NAME": name,
                        "DAY": day,
                        "MONTH": month,
                        "YEAR": year
                    },
                        columns=["NAME", "DAY", "MONTH", "YEAR"])
html = pug_to_html("RevenueReport.pug", revenue=data_frames, revenue2=data_frames2)
print(type(data_frames))#<class 'pandas.core.frame.DataFrame'>
filename = 'revenuereport.pdf'
write_report(html, filename)

Is it possible to pass several dataframes to one variable, so that in the pug file it would be possible to loop through and split the tables? In general, the task is such that the input has a different number of dataframes and how much to transfer is not known in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Shitskov, 2019-06-10
@Zarom

No, but you can merge dataframes
https://pandas.pydata.org/pandas-docs/stable/user_...

E
Electro House, 2019-06-10
@laim731

Not familiar with pandas, but it seems to me that a nested dictionary will solve this complexity.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question