diff --git a/Problem_Statement2.py b/Problem_Statement2.py index 225ecf2..a03b6ae 100644 --- a/Problem_Statement2.py +++ b/Problem_Statement2.py @@ -1,18 +1,4 @@ -#############################Problem 2:Constituency-Level Election Insights############################## -import pandas as pd -import numpy as np -import matplotlib.pyplot as plt -import seaborn as sns -# Load the dataset -df=pd.read_csv(r"C:\Users\ayush\OneDrive\Desktop\PythonCA2\Data.csv") - -###Objective 1: Identify constituencies with the highest and lowest number of candidates -# Count candidates per constituency -candidates_per_constituency = df.groupby('ac_name')['candidate_name'].nunique() -# Find the highest and lowest -highest_constituency = candidates_per_constituency.idxmax() -lowest_constituency = candidates_per_constituency.idxmin() print(f"Constituency with highest candidates:{highest_constituency}({candidates_per_constituency.max()} candidates)") print(f"Constituency with lowest candidates:{lowest_constituency}({candidates_per_constituency.min()} candidates)")