0% found this document useful (0 votes)
8 views

Project Anish

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Project Anish

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 27

NEW ERA PUBLIC SCHOOL, DWARKA

Academic Session: 2023-24

A Project Report
on
“Weather Report of India”
(For AISSCE 2023-24 Examination)

Submitted by: Anish Das Project Guide:


Roll No: Ms. Usha Patnaik Das
Name: Anish Das PGT (Computer Science)
Class: XII
Subject: Informatics Practices
Subject Code:065

1
Certificate

This is to certify that ANISH DAS of Class

XII(Commerce), New Era Public School Dwarka, has

successfully developed his Informatics Practices Project

titled “Weather Report of India”, under my supervision.

The work done by him is original and is submitted for the

AISSCE (Session 2023-24) as prescribed by CBSE.

Signature of Signature of
Internal Examiner External Examiner

Signature of Principal

2
Declaration

I hereby declare that the project work entitled “Weather


Report of India”, submitted to Department of Computer
Science, New Era Public School, Dwarka is prepared by me.
All the coding is the result of my personal efforts.

Anish Das
XII (Commerce)

3
Acknowledgement

I would like to express my special thanks to my


Informatics Practices teacher, Mrs. Usha Patnaik Das
for her able guidance and support in completing my
project.

I would also like to thank our Principal, Mrs. Kanwal Kohli,


for providing me with all the necessary facilities.

Anish Das
XII (Commerce)

4
Index
S. No. Title Page Nos.
6
1. Introduction to the Project

7
2. Objective & Scope of the Project

8
3. Hardware and Software Requirements

9-11
4. Modules and Functions used

12-13
5. CSV Files used

14-18
6. Coding

19-25
7. Output Screens

26
8. User Manual

27
9. Bibliography

5
Introduction to the Project
The Earth's atmosphere is a dynamic and ever-changing system,
influencing our daily lives in myriad ways. From the clothes we
wear to the activities we plan, the weather plays a crucial role in
shaping our experiences. Understanding and predicting weather
patterns are essential for a variety of sectors, including agriculture,
transportation, emergency management, and more.
+

This weather report project aims to delve into the distinctive climatic
conditions of different Indian states, providing a comprehensive
overview of the meteorological nuances that define each region. By
examining temperature variations, precipitation levels, seasonal
changes, and extreme weather events, we seek to unravel the
complex interplay of geographical features and atmospheric
phenomena that contribute to India's diverse weather landscape.

6
Objective & Scope of the Project
AIM :
To Develop Weather Report Analysis System of India

 For quick analysis and visuals of the data of various states of


India.
 To quickly know the status of Weather Report of few
states in India
 To give visual depiction of the weather status in terms of
line chart, bar chart, histogram and pie chart.

7
Hardware and Software
Requirements

Hardware Requirements:

∗Processor:
∗RAM:
Intel Core i5

∗Hard disk:
32GB

∗CD/DVD/Pen-drive:
500 GB

∗Printer:
Pen-drive
Inkjet

Software Requirements:

∗Windows 11
∗Python 3.11
∗MySQL 5.5
∗Microsoft Word 2019

8
Modules and Functions Used

Following modules are used in this project:

PANDAS: -
Pandas is a high-level data manipulation tool developed by Wes
McKinney. It is built on the Numpy package, and its
key data structure is called the DataFrame. DataFrames
allow you to store and manipulate tabular data in
rows of observations and columns of variables.

MATPLOTLIB: -
Matplotlib is a Comprehensive library
for creating static, animated, and
interactive visualizations in Python.
Matplotlib makes easy things easy
and hard things possible.
Create publication quality plots. Make interactive figures that can

9
zoom, pan, update. Customize visual style and layout.

Following functions are used in this project:

 head/tail (): The head and tail function prints the top and bottom
values of the file as per user specified.

 read_csv(): The read_csv() reads a comma separated values (csv)


file into DataFrame. Also supports optionally iterating or
breaking the file into chunks.

 print():The print() function prints the specified message to


the screen, or other standard output device.

 input():Python input() function is used to take user input plot():


The plot () function is used to draw points (markers) in a diagram.
By default, the plot () function draws a line from point to point. The
function takes parameters for specifying points in the diagram.

 xlabel(): The xlabel () function in pyplot module of matplotlib


library is used to set the label for the x-axis.

 ylabel(): The ylabel () function in pyplot module of matplotlib


library is used to set the label for the y-axis.

10
 xticks():The plt.xticks () gets or sets the properties of tick locations
and labels of the x-axis. 'Rotation = 45' is passed as an argument to
the plt.xticks () function.

 show(): The show() method writes the image to a temporary file


and then triggers the default program to display that image. Once
the program execution is completed, the temporary file will be
deleted.

 sort_values():The sort_values() method sorts the DataFrame by the


specified label.

 max():Python max() function returns the largest item in an iterable


or the largest of two or more arguments

11
CSV Files Used
weather.csv (Excel View):

12
literacy_rate.csv (Notepad View):

13
CODING
import csv
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.ion

def menu():
print("WEATHER REPORT")
print("0. Know about the project")
print("1. Reading file bank")
print("2. Reading file bank without index")
print("3. Add Detail of new state")
print("4. Delete Data")
print("5. Read few records")
print("6. Read 2 records from top and 2 from bottom")
print("7. Arrange details in ascending order by State name")
print("8. Line Chart")
print("9. Bar Chart")
print("10. Horizontal Barchart")
print("11. Histogram")
print("12.Pie Chart")
print("13. Quit")

menu()

# Option 0: About the project


def about():
print("In the Weather Report project, there is a csv file name: 'Weather.csv'.")
print("There are 12 options, including various operations and four types of
charts used in python matplotlib.")

14
# Option 1: Read 'weather.csv' with index
def weathercsv():
print("Reaading the file 'weather.csv' with index:")
df =pd.read_csv("C:\\pythonn\\weather.csv", index_col=0)
print(df)
print()

# Option 2: Read 'weather.csv' without index


def no_index():
print("Reading the file 'weather.csv' without index:")
df = pd.read_csv("C:\\pythonn\\weather.csv")
print(df)

def add_state():
# Collect user information
city = input("Enter the states name: ")
Min_Temp = float(input("Enter the minimum temp: "))
Max_Temp = float(input("Enter the maximum temp: "))
Avg_Temp = float(input("Enter the avg temp: "))

# Create a dictionary with the account holder's information


new_state_name = {
'City': [city],
'Min_Temp': [Min_Temp],
'Max_Temp': [Max_Temp],
'Avg_Temp': [Avg_Temp],
}

# Load the CSV file into a DataFrame


file_path = "C:\\pythonn\\weather.csv"
df = pd.read_csv(file_path, index_col=0)

# Create a DataFrame for the new state


new_df = pd.DataFrame(new_state_name)

# Concatenate the new DataFrame with the existing DataFrame


df = pd.concat([df, new_df], ignore_index=True)

# Save the updated DataFrame back to the CSV file

15
df.to_csv(file_path)

print("New State added successfully.")


print(df)

# Option 4: Remove State


def removestate():
print('Delete state from file')
df = pd.read_csv("C:\\pythonn\\weather.csv", index_col=0)
print(df)
name_to_delete = input("Enter the name you want to delete: ")
df = df[df['City'] != name_to_delete]
df.to_csv("C:\\pythonn\\weather.csv")
print("State deleted successfully.")
print(df)

# Option 6: Read 2 records from the top and 2 from the bottom
def top_bottom():
print("Displaying the top 2 and bottom 2 records:")
df = pd.read_csv("C:\\pythonn\\weather.csv")
top_2 = df.head(2)
bottom_2 = df.tail(2)
print(top_2)
print(bottom_2)

# Option 7: Sort state names in ascending order


def sort_names():
print('Sorting state names in ascending order:')
df = pd.read_csv("C:\\pythonn\\weather.csv", index_col=0)
df = df.sort_values('City')
print(df)

# Option 8: Line Chart


def line_chart():
print('Line Chart')
df = pd.read_csv("C:\\pythonn\\weather.csv")
x_values=df['City']
y_values=df['Avg_Temp']
plt.plot(x_values, y_values, label='Data')
plt.title('Line Chart from CSV Data')
16
plt.xlabel('X-axis Label')
plt.ylabel('Y-axis Label')
plt.legend()
plt.show()

# Option 9: Bar Chart


def bar_chart():
print('Bar Plot')
df = pd.read_csv("C:\\pythonn\\weather.csv")
x = df['City']
y = df['Avg_Temp']
plt.title('Bar Chart Of Weather Report')
plt.xlabel('City')
plt.ylabel('Temperature')
plt.bar(x, y, color='red')
plt.show()

# Option 10: Horizontal Bar Chart


def horizontalbar_chart():
print('Bar chart')
df = pd.read_csv("C:\\pythonn\\weather.csv")
x = df['City']
y = df['Avg_Temp']
plt.title('Balance of Account Holders')
plt.xlabel('City')
plt.ylabel('Temperature')
plt.barh(x, y, color=['red', 'green'])
plt.show()

# Option 11: Histogram


def histogram():
print('Histogram')
df = pd.read_csv("C:\\pythonn\\weather.csv")
values= df['Avg_Temp']
plt.title('Weather Report')
plt.xlabel('City')
plt.ylabel('Temperature')
plt.hist(values, color='cyan', bins=10)
plt.show()

17
# Option 12: Pie Chart
def piechart():
print("Pie Chart")
df=pd.read_csv("C:\\pythonn\\weather.csv")
categories = df['City']
values = df['Avg_Temp']
plt.pie(values, labels=categories, autopct='%1.1f%%', startangle=90,
colors=['red', 'green', 'blue', 'yellow'])
plt.title('Pie Chart Of Weather Report')
plt.show()

choice = 'y'
while choice == 'y' or choice == 'Y':
opt = int(input("Enter your choice: "))
if opt == 0:
about()
elif opt == 1:
weathercsv()
elif opt == 2:
no_index()
elif opt == 3:
add_state()
elif opt == 4:
removestate()
elif opt == 5:
read_rows()
elif opt == 6:
top_bottom()
elif opt == 7:
sort_names()
elif opt == 8:
line_chart()
elif opt == 9:
bar_chart()
elif opt == 10:
horizontalbar_chart()
elif opt == 11:
histogram()
elif opt== 12:
piechart()
18
elif opt == 13:
print("Exiting the program.")
break
else:
print('Invalid option. Please select a valid option.')

choice = input("Do you want to continue (y/n): ")


print("Thank you for using the Weather Report.")

Output Screens

19
20
21
22
23
24
25
User Manual
A screen with the main menu will appear, asking from the user when
the Program is executed. It will print the following options:

Main Menu:
1. Knowing about the project

2. Reading file

3. Reading file without index

4. Add details of new state

5. Delete details of a state

6. Line Chart

7. Bar Chart

8. Horizontal Barchart

9. Histogram

10. Pie Chart

26
Bibliography

Books:
 Informatics Practices with Python by Sumita Arora

 Informatics Practices with Python by Preeti Arora

Websites:
 Python.mykvs.in

 www.programiz.com

 www.brainly.com

 Python.org

27

You might also like