Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import pandas as pd | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import random | |
| import requests | |
| st.markdown(""" | |
| <style> | |
| /* Set a soft background color */ | |
| body { | |
| background-color: #eef2f7; | |
| } | |
| /* Style for main title */ | |
| h1 { | |
| color: #00FFFF; | |
| font-family: 'Roboto', sans-serif; | |
| font-weight: 700; | |
| text-align: center; | |
| margin-bottom: 25px; | |
| } | |
| /* Style for headers */ | |
| h2 { | |
| color: #FFFACD; | |
| font-family: 'Roboto', sans-serif; | |
| font-weight: 600; | |
| margin-top: 30px; | |
| } | |
| /* Style for subheaders */ | |
| h3 { | |
| color: #ba95b0; | |
| font-family: 'Roboto', sans-serif; | |
| font-weight: 500; | |
| margin-top: 20px; | |
| } | |
| .custom-subheader { | |
| color: #00FFFF; | |
| font-family: 'Roboto', sans-serif; | |
| font-weight: 600; | |
| margin-bottom: 15px; | |
| } | |
| /* Paragraph styling */ | |
| p { | |
| font-family: 'Georgia', serif; | |
| line-height: 1.8; | |
| color: #FFFFFF; | |
| margin-bottom: 20px; | |
| } | |
| /* List styling with checkmark bullets */ | |
| .icon-bullet { | |
| list-style-type: none; | |
| padding-left: 20px; | |
| } | |
| .icon-bullet li { | |
| font-family: 'Georgia', serif; | |
| font-size: 1.1em; | |
| margin-bottom: 10px; | |
| color: #FFFFF0; | |
| } | |
| .icon-bullet li::before { | |
| content: "βοΈ"; | |
| padding-right: 10px; | |
| color: #b3b3ff; | |
| } | |
| /* Sidebar styling */ | |
| .sidebar .sidebar-content { | |
| background-color: #ffffff; | |
| border-radius: 10px; | |
| padding: 15px; | |
| } | |
| .sidebar h2 { | |
| color: #495057; | |
| } | |
| /* Custom button style */ | |
| .streamlit-button { | |
| background-color: #00FFFF; | |
| color: #000000; | |
| font-weight: bold; | |
| } | |
| </style> | |
| """, unsafe_allow_html=True) | |
| st.title("π Handling Excel Files π") | |
| 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) | |
| st.subheader("π How to read an Excel file?") | |
| rcode = ''' | |
| df = pd.read_excel(r"/Users/rajbunny/Downloads/FSI-2023-DOWNLOAD.xlsx") | |
| ''' | |
| st.code(rcode, language="python") | |
| st.subheader("π How to read an Excel file with multiple sheets?") | |
| mcode = ''' | |
| df = pd.read_excel(r"/Users/rajbunny/Downloads/Book3.xlsx", sheet_name=[0, 1, 2]) | |
| ''' | |
| st.code(mcode, language="python") | |
| st.subheader("πΎ How to save DataFrame back to Excel?") | |
| scode = ''' | |
| with pd.ExcelWriter(r'/Users/rajbunny/Downloads/untitled_folder.xlsx', mode="x") as f2: | |
| df[0].to_excel(f2, sheet_name='student_info') | |
| df[1].to_excel(f2, sheet_name='sem1') | |
| df[2].to_excel(f2, sheet_name='sem2') | |
| ''' | |
| st.code(scode, language="python") | |
| st.subheader("π To view the coding part of the Jupyter notebook:") | |
| if st.button("π Open Jupyter Notebook"): | |
| notebook_url = "https://github.com/raj2216/my-code/blob/main/exel.ipynb" | |
| st.markdown(f"[Click here to go to the Jupyter notebook] {notebook_url}", unsafe_allow_html=True) | |