Import Pandas As PD
Import Pandas As PD
What is python?
Features of Python:
Pandas is a Python library used for working with data sets. It has functions for
analysing, cleaning, exploring, and manipulating data.
The name "Pandas" has a reference to both "Panel Data", and "Python Data
Analysis" and was created by Wes McKinney in 2008.
Pandas allows us to analyse big data and make conclusions based on
statistical theories.
Pandas can clean messy data sets, and make them readable and relevant.
Relevant data is very important in data science.
What is matplotlib?
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
# File paths
file1 = "C:/Users/santa/OneDrive/Desktop/monish reddy/ip pr 1.csv"
file2 = "C:/Users/santa/OneDrive/Desktop/monish reddy/ip pr2.csv"
# Load datasets
data1 = pd.read_csv(file1) # Load the first dataset containing
information about registered parties
data2 = pd.read_csv(file2) # Load the second dataset containing
votes information
# Menu-driven program
while True:
# Display menu options for the user to choose the type of graph
print("\nChoose a graph to generate:")
print("1. Pie chart of Registered Parties")
print("2. Bar chart of Registered Parties by State")
print("3. Bar chart of Votes by Constituency")
print("4. Candlestick chart of Constituencies by State")
print("5. Scatter plot of Votes vs Constituencies")
print("6. Bar chart of Votes by State")
print("7. Candlestick chart of Votes by State")
print("8. Exit")
choice = input("Enter your choice (1-8): ") # Get user input for the
graph selection
if choice == '1':
# Pie chart of Registered Parties
registered_parties = data1['REGISTERED PARTIES'].value_counts()
# Get the count of each party type
labels = registered_parties.index # Party labels
values = registered_parties.values # Party counts
else:
print("Invalid choice. Please enter a number between 1 and 8.")
# Handle invalid input
OUTPUT
GRAPHS
FIGURE 1
FIGURE 2
FIGURE 3
FIGURE 4
FIGURE 5
FIGURE 6
FIGURE-7
CSV-FILES
CSV-1
CSV-2
RESOURCES
WWW.GOOGLE.COM
WWW.TIMES OF INDIA.COM
WWW.THE HINDU.COM
WWW.GOV IND.COM
WWW.WIKIPEDIA.com