Please help me with this question from 1 to 6 by using python This assignment ex
ID: 3811980 • Letter: P
Question
Please help me with this question from 1 to 6 by using python
This assignment explores the "History of the Federal Electoral Ridings, 1867-2010" dataset from the Government of Canada Open Data Portal (found here). The dataset consists of every candidate who has run in a federal election from 1867 to 2010. The dataset has been downloaded and formatted for this assignment. Follow the instructions below. Use pandas. read-csv to import the elections .csv dataset from the URL http://www.math.ubc.ca/^-pwalls/data/elections.csv You will need to use encoding = 'latin' since there are French accent characters in some of the names in the dataset. Use the dataframe methods .info .head and .tail to get an overview of the data. What is the most common occupation of elected members of parliament? How many different parties have had a candidate elected? There were 2 candidates who received 100% of the votes in an election. Who were they? Which candidate has been elected the most times? Which candidate has lost the most elections? Create a bar plot showing the number of different ridings per province in the 40th ParliamentExplanation / Answer
2) 6 parties and others are unknown
3)
R code:
library(plyr);
cdata = read.csv(file = "/home/kumar/Desktop/elections.csv");
originalEncoding="latin";
numCols <- ncol(cdata)
for (col in 1:numCols) Encoding(cdata[, col]) <- originalEncoding;
#print(cdata);
elected = subset(cdata,Elected=1);
lost = subset(cdata,Elected=0);
summary(cdata);
summary(elected);
summary(lost);
head(cdata);
print(subset(elected,Votes....== 100.00));
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.