mwouts / itables

Pandas DataFrames as Interactive DataTables
https://mwouts.github.io/itables/
MIT License
710 stars 53 forks source link

Download CSV and Excel #272

Closed firmai closed 1 month ago

firmai commented 1 month ago

Why does CSV and Excel not download, for example in pandas to_csv and to_excel is half a second, but this does not work and when it works takes minutes. Is there a workaround.

from itables import show

import pandas as pd
import numpy as np

# Creating fake data for 100 columns and 6000 rows
np.random.seed(42)  # for reproducibility
data = np.random.rand(6000, 100)  # Random data generation
columns = [f"Column_{i+1}" for i in range(100)]  # Naming the columns as Column_1 to Column_100

# Creating the DataFrame
df_summary = pd.DataFrame(data, columns=columns)
df_summary.head()

show(df_summary, buttons=["copyHtml5", "csvHtml5", "excelHtml5"], maxRows=60000,maxBytes=5000000)

Suprisingly 5000 rows work

mwouts commented 1 month ago

Hi @firmai , this is currently a limitation in the javascript library datatables.net that we use to render the tables. They are working on it and when the problem gets solved there I will update itables. Please subscribe to https://github.com/mwouts/itables/issues/251 for updates.

firmai commented 1 month ago

Thanks for that.