Open iuiu34 opened 1 year ago
Would be nice to be able to customize the download filename in chart_container. So that,
chart_container(data`, filename="test")
downloads files "test.csv", "test.parquet" instead of always "data.csv", "data.parquet".
This is only about exposing "data" arg in line 88 as an argument of the class.
def chart_container( data: pd.DataFrame, tabs: Sequence[str] = ( "Chart 📈", "Dataframe 📄", "Export 📁", ), export_formats: Sequence[str] = _SUPPORTED_EXPORT_KEYS, filename: str ) -> Generator: (...) with tab_3: st.caption("Export limited to 1 million rows.") export_data = data.head(1_000_000) for chosen_export_format in export_formats: export_utils = _SUPPORTED_EXPORTS[chosen_export_format] exporter = export_utils["function"] extension = export_utils["extension"] st.download_button( f"Download data as {extension}", data=exporter(export_data), file_name=filename + extension, mime=export_utils.get("mime"), key=_get_random_widget_key(), )
![DESCRIPTION](LINK.png)
Hey @iuiu34, good idea. Feel free to drop a PR for this if you still need it!
Description
Would be nice to be able to customize the download filename in chart_container. So that,
downloads files "test.csv", "test.parquet" instead of always "data.csv", "data.parquet".
This is only about exposing "data" arg in line 88 as an argument of the class.
Minimal code for the extra
Screenshots