Created
September 14, 2024 12:44
-
-
Save ChandanShakya/da62b57d5e5a14a7d15324e28b770183 to your computer and use it in GitHub Desktop.
Python script to create a excel sheet for practical of Data Analysis and Visualization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from openpyxl import Workbook | |
from openpyxl.styles import Alignment | |
# Create a workbook and get the active worksheet | |
wb = Workbook() | |
ws = wb.active | |
# Define the data for each practical | |
practicals = { | |
"Practical 1": [ | |
"Load the given dataset and display first 10 data and last 10 data", | |
"Display all the name of column", | |
"Display unique species of flower", | |
"Display whether there is null value present or not", | |
"Display the average data like mean media mode", | |
"Display the data type of each column", | |
"Find out whether data type matched with object or not", | |
"Find out floating type data", | |
"Display data of any one column only", | |
"Display the data of only one column from row 4 to 16", | |
"Remove any one column temporarily and display the result", | |
"Temporarily remove null value and display result", | |
"Replace null values with word 'no' and display the result", | |
"Plot a line chart for sepal length and sepal width", | |
"Plot a scatter plot for (sepal length and sepal width), (petal length and petal width)", | |
"Plot a scatter plot for (sepal length and petal length), (sepal width and petal width) for each species", | |
"Plot the distribution of sepal length histogram", | |
"Plot the distribution of petal width using histogram", | |
"Plot a multiple histogram for each species showing distribution of sepal width", | |
"Plot a bar graph of sepal length for each species", | |
"Plot a count plot for sepal length for each species", | |
"Plot a density plot (distplot) for sepal_length", | |
"Plot a density plot on sepal_length with histogram", | |
"Plot a density plot (distplot) for sepal_length for each species", | |
"Plot a heatmap to find out co-relation", | |
"Plot box and whisker plot to find out quartile deviation of sepal width for each species", | |
"Plot box and whisker plot to find out quartile deviation of sepal length for each species" | |
], | |
"Practical 2": [ | |
"Create an empty graph, add 5 nodes in it and add edges by your choice and then display the graph", | |
"Create a graph as circular layout", | |
"Create a triangle shape graph from question 1", | |
"Create a random layout graph for node defined in question 1", | |
"Create a tree map for your own data and display the result", | |
"Create a word cloud for your own data and display the result", | |
"Create a word frequency chart for your own data" | |
], | |
"Practical 3": [ | |
"Import tip data set from seaborn library", | |
"Display first 50 and last 50 data sets", | |
"Display information of each column", | |
"Display unique column in dataset", | |
"Display line chart for totalbill and tip", | |
"Display scatter plot for total bill and tip with respect to sex", | |
"Display scatter plot for total bill and tip with respect to smoker", | |
"Display barplot for tip with respect to sex", | |
"Display barplot for tip with respect to smoker and tip", | |
"Display the distribution of tips using histogram", | |
"Display histogram for male and female separately for tip they pay", | |
"Display count plot tip with respect to sex", | |
"Display barplot for day and total bill with respect to sex", | |
"Display scatter plot for total bill and tip with respect to sex", | |
"Display distplot for total bill", | |
"Display distplot with histogram for total bill" | |
] | |
} | |
# Add data to Excel sheet | |
for practical, tasks in practicals.items(): | |
# Add a header row for each practical | |
ws.append(["S.N", "Topic", "Date of Submission", "Signature", "Remarks"]) | |
# Add tasks with an increasing serial number | |
for i, task in enumerate(tasks, 1): | |
ws.append([i, task, "", "", ""]) | |
# Wrap text in the 'Topic' column (column B) | |
ws.cell(row=ws.max_row, column=2).alignment = Alignment(wrap_text=True) | |
# Add a blank row to separate practicals | |
ws.append([]) | |
# Save the workbook | |
wb.save("practicals_wrapped.xlsx") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment