diff --git a/src/vuegen/streamlit_reportview.py b/src/vuegen/streamlit_reportview.py index 69ce63a..22da703 100644 --- a/src/vuegen/streamlit_reportview.py +++ b/src/vuegen/streamlit_reportview.py @@ -755,14 +755,14 @@ def _generate_dataframe_content(self, dataframe) -> List[str]: r.DataFrameFormat.XLSX.value_with_dot, ]: dataframe_content.append("selected_sheet = 0") - sheet_names = table_utils.get_sheet_names(dataframe.file_path) + sheet_names = table_utils.get_sheet_names(df_file_path.as_posix()) if len(sheet_names) > 1: # If there are multiple sheets, ask the user to select one dataframe_content.append( textwrap.dedent( f"""\ - sheet_names = table_utils.get_sheet_names("{dataframe.file_path}") + sheet_names = table_utils.get_sheet_names("{df_file_path.as_posix()}") selected_sheet = st.selectbox("Select a sheet to display", options=sheet_names) """ ) @@ -775,7 +775,7 @@ def _generate_dataframe_content(self, dataframe) -> List[str]: r.DataFrameFormat.XLSX.value_with_dot, ]: dataframe_content.append( - f"""df = pd.{read_function.__name__}('{dataframe.file_path}', sheet_name=selected_sheet)\n""" + f"""df = pd.{read_function.__name__}('{df_file_path.as_posix()}', sheet_name=selected_sheet)\n""" ) else: dataframe_content.append( diff --git a/tests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/sections/Dataframes/All_Formats.py b/tests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/sections/Dataframes/All_Formats.py index a26eb0a..5d60849 100644 --- a/tests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/sections/Dataframes/All_Formats.py +++ b/tests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/sections/Dataframes/All_Formats.py @@ -30,10 +30,10 @@ df_index += 1 st.markdown('''

Abundance Table Example Xls

''', unsafe_allow_html=True) selected_sheet = 0 -sheet_names = table_utils.get_sheet_names("/home/runner/work/vuegen/vuegen/docs/example_data/Basic_example_vuegen_demo_notebook/2_Dataframes/1_All_formats/2_abundance_table_example_xls.xls") +sheet_names = table_utils.get_sheet_names("docs/example_data/Basic_example_vuegen_demo_notebook/2_Dataframes/1_All_formats/2_abundance_table_example_xls.xls") selected_sheet = st.selectbox("Select a sheet to display", options=sheet_names) -df = pd.read_excel('/home/runner/work/vuegen/vuegen/docs/example_data/Basic_example_vuegen_demo_notebook/2_Dataframes/1_All_formats/2_abundance_table_example_xls.xls', sheet_name=selected_sheet) +df = pd.read_excel('docs/example_data/Basic_example_vuegen_demo_notebook/2_Dataframes/1_All_formats/2_abundance_table_example_xls.xls', sheet_name=selected_sheet) # Displays a DataFrame using AgGrid with configurable options. @@ -103,7 +103,7 @@ df_index += 1 st.markdown('''

Example Xlsx

''', unsafe_allow_html=True) selected_sheet = 0 -df = pd.read_excel('/home/runner/work/vuegen/vuegen/docs/example_data/Basic_example_vuegen_demo_notebook/2_Dataframes/1_All_formats/5_example_xlsx.xlsx', sheet_name=selected_sheet) +df = pd.read_excel('docs/example_data/Basic_example_vuegen_demo_notebook/2_Dataframes/1_All_formats/5_example_xlsx.xlsx', sheet_name=selected_sheet) # Displays a DataFrame using AgGrid with configurable options.