Skip to content

Commit e151711

Browse files
sayalaruanoenryH
andauthored
πŸ› Make excel df paths relative instead of absolute (#134)
* πŸ› Make excel df paths relative insetad of absolute * βœ… update tests to match relative paths usage --------- Co-authored-by: Henry Webel <[email protected]>
1 parent 5677951 commit e151711

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

β€Žsrc/vuegen/streamlit_reportview.pyβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,14 +755,14 @@ def _generate_dataframe_content(self, dataframe) -> List[str]:
755755
r.DataFrameFormat.XLSX.value_with_dot,
756756
]:
757757
dataframe_content.append("selected_sheet = 0")
758-
sheet_names = table_utils.get_sheet_names(dataframe.file_path)
758+
sheet_names = table_utils.get_sheet_names(df_file_path.as_posix())
759759
if len(sheet_names) > 1:
760760
# If there are multiple sheets, ask the user to select one
761761

762762
dataframe_content.append(
763763
textwrap.dedent(
764764
f"""\
765-
sheet_names = table_utils.get_sheet_names("{dataframe.file_path}")
765+
sheet_names = table_utils.get_sheet_names("{df_file_path.as_posix()}")
766766
selected_sheet = st.selectbox("Select a sheet to display", options=sheet_names)
767767
"""
768768
)
@@ -775,7 +775,7 @@ def _generate_dataframe_content(self, dataframe) -> List[str]:
775775
r.DataFrameFormat.XLSX.value_with_dot,
776776
]:
777777
dataframe_content.append(
778-
f"""df = pd.{read_function.__name__}('{dataframe.file_path}', sheet_name=selected_sheet)\n"""
778+
f"""df = pd.{read_function.__name__}('{df_file_path.as_posix()}', sheet_name=selected_sheet)\n"""
779779
)
780780
else:
781781
dataframe_content.append(

β€Žtests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/sections/Dataframes/All_Formats.pyβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
df_index += 1
3131
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Abundance Table Example Xls</h4>''', unsafe_allow_html=True)
3232
selected_sheet = 0
33-
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")
33+
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")
3434
selected_sheet = st.selectbox("Select a sheet to display", options=sheet_names)
3535

36-
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)
36+
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)
3737

3838

3939
# Displays a DataFrame using AgGrid with configurable options.
@@ -103,7 +103,7 @@
103103
df_index += 1
104104
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Example Xlsx</h4>''', unsafe_allow_html=True)
105105
selected_sheet = 0
106-
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)
106+
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)
107107

108108

109109
# Displays a DataFrame using AgGrid with configurable options.

0 commit comments

Comments
Β (0)