Spaces:
Sleeping
Sleeping
Update pages/5_Structured_data.py
Browse files- pages/5_Structured_data.py +1 -13
pages/5_Structured_data.py
CHANGED
|
@@ -83,38 +83,26 @@ st.markdown("""
|
|
| 83 |
|
| 84 |
st.title("π Handling Excel Files π")
|
| 85 |
st.markdown("Excel is a tool for organizing and analyzing data in a structured table format using rows and columns. It's commonly used for storing and analyzing datasets. π", unsafe_allow_html=True)
|
| 86 |
-
|
| 87 |
-
# Code for reading Excel file
|
| 88 |
st.subheader("π How to read an Excel file?")
|
| 89 |
rcode = '''
|
| 90 |
-
# Reading an Excel file with a single sheet
|
| 91 |
df = pd.read_excel(r"/Users/rajbunny/Downloads/FSI-2023-DOWNLOAD.xlsx")
|
| 92 |
'''
|
| 93 |
st.code(rcode, language="python")
|
| 94 |
-
|
| 95 |
-
# Code for reading Excel file with multiple sheets
|
| 96 |
st.subheader("π How to read an Excel file with multiple sheets?")
|
| 97 |
mcode = '''
|
| 98 |
-
# Reading multiple sheets from an Excel file
|
| 99 |
df = pd.read_excel(r"/Users/rajbunny/Downloads/Book3.xlsx", sheet_name=[0, 1, 2])
|
| 100 |
'''
|
| 101 |
st.code(mcode, language="python")
|
| 102 |
-
|
| 103 |
-
# Code for saving DataFrame back to Excel
|
| 104 |
st.subheader("πΎ How to save DataFrame back to Excel?")
|
| 105 |
scode = '''
|
| 106 |
-
# Saving DataFrame to a new Excel file
|
| 107 |
with pd.ExcelWriter(r'/Users/rajbunny/Downloads/untitled_folder.xlsx', mode="x") as f2:
|
| 108 |
df[0].to_excel(f2, sheet_name='student_info')
|
| 109 |
df[1].to_excel(f2, sheet_name='sem1')
|
| 110 |
df[2].to_excel(f2, sheet_name='sem2')
|
| 111 |
'''
|
| 112 |
st.code(scode, language="python")
|
| 113 |
-
|
| 114 |
-
# Interactive button for Jupyter notebook link
|
| 115 |
st.subheader("π To view the coding part of the Jupyter notebook:")
|
| 116 |
-
|
| 117 |
if st.button("π Open Jupyter Notebook"):
|
| 118 |
notebook_url = "http://localhost:8888/notebooks/exel.ipynb"
|
| 119 |
-
st.markdown(f"[Click here to go to the Jupyter notebook]
|
| 120 |
|
|
|
|
| 83 |
|
| 84 |
st.title("π Handling Excel Files π")
|
| 85 |
st.markdown("Excel is a tool for organizing and analyzing data in a structured table format using rows and columns. It's commonly used for storing and analyzing datasets. π", unsafe_allow_html=True)
|
|
|
|
|
|
|
| 86 |
st.subheader("π How to read an Excel file?")
|
| 87 |
rcode = '''
|
|
|
|
| 88 |
df = pd.read_excel(r"/Users/rajbunny/Downloads/FSI-2023-DOWNLOAD.xlsx")
|
| 89 |
'''
|
| 90 |
st.code(rcode, language="python")
|
|
|
|
|
|
|
| 91 |
st.subheader("π How to read an Excel file with multiple sheets?")
|
| 92 |
mcode = '''
|
|
|
|
| 93 |
df = pd.read_excel(r"/Users/rajbunny/Downloads/Book3.xlsx", sheet_name=[0, 1, 2])
|
| 94 |
'''
|
| 95 |
st.code(mcode, language="python")
|
|
|
|
|
|
|
| 96 |
st.subheader("πΎ How to save DataFrame back to Excel?")
|
| 97 |
scode = '''
|
|
|
|
| 98 |
with pd.ExcelWriter(r'/Users/rajbunny/Downloads/untitled_folder.xlsx', mode="x") as f2:
|
| 99 |
df[0].to_excel(f2, sheet_name='student_info')
|
| 100 |
df[1].to_excel(f2, sheet_name='sem1')
|
| 101 |
df[2].to_excel(f2, sheet_name='sem2')
|
| 102 |
'''
|
| 103 |
st.code(scode, language="python")
|
|
|
|
|
|
|
| 104 |
st.subheader("π To view the coding part of the Jupyter notebook:")
|
|
|
|
| 105 |
if st.button("π Open Jupyter Notebook"):
|
| 106 |
notebook_url = "http://localhost:8888/notebooks/exel.ipynb"
|
| 107 |
+
st.markdown(f"[Click here to go to the Jupyter notebook] {notebook_url}", unsafe_allow_html=True)
|
| 108 |
|