Get the App
SLTechnology News&Howtos  ›  Development  › 

An example Analysis of the Statistics of Beijing College entrance examination score Line in Python

Shulou Source: shulou.com Published: 2022-06-02 04:58:12 09月26日 Update

I would like to share with you the sample analysis of the statistics of the score line of the college entrance examination in Beijing in Python. I believe most people don't know much about it yet, so I hope you can learn a lot from reading this article. Let's go and learn about it.

Foreword:

In order to help the vast number of candidates and parents understand the admission situation of the college entrance examination over the years, many websites have summarized the admission control lines of various provinces and cities, in order to provide reference for the majority of candidates to fill in and volunteer. Due to a variety of factors, the score line changes more or less each year. Collect information of Beijing from 2006 to 2019. Use Python's Pandas library to complete the following data analysis.

1.1 data crawling

It contains three parts: where to crawl, how to crawl, and the result of crawling.

Code:

Import pandas as pdimport numpy as npdata=pd.read_excel ("scores.xlsx", header=1) print (data)

Running result:

Analysis: I am reading the local data file for data analysis.

If you are interested, you can download the relevant data from the website or use crawlers to crawl the relevant data sources. Conduct data analysis

In the analysis part of this data, I mainly use Pandas numpy to preprocess the data.

Visually display the data with matplotlib.

1.2 Statistics with the highest and lowest scores

Mindata= data.groupby (['liberal arts', 'science'], as_index=False) .min (axis=1) maxdata= data.groupby (['liberal arts', 'science'], as_index=False) .max (axis=2) print (data.min ()) print (data.max ())

Data processing, the highest score and the lowest score statistics, because there are two different years of results, and divided into liberal arts and science, so there are two liberal arts and two sciences.

We use groupby to group by arts and science.

Then use max () and min () to find the maximum and minimum'

After analysis and processing, you can see the maximum and minimum values printed out.

1.3 Statistics of the difference between science majors in ordinary universities

Code:

S1math=data ["one score line", "science"] print (s1math) print (s1math [0]-s1math [2]) s1c=data ["one score line", "liberal arts"] print (s1c [0]-s1c [2]) s2math=data ["ordinary university score line", "science"] print (s2math [0]-s2math [2]) s2c=data ["ordinary university score line", "liberal arts"] print (s2math [0]-s2math [2])

Running result:

Note:

First of all, we take out the results of the corresponding liberal arts and science universities and ordinary universities, and then calculate the relevant range, that is, using the previous number minus the latter number on OK.

Print (s1math [0]-s1math [2]) 1.4Statistics of the average score line of each subject in recent 14 years from 2006 to 2019

Code:

# Statistics of the average score line per subject in the past 14 years from 2006 to 2019 data1=data [data ['Unnamed: 0'] .between (2006, 2014, inclusive=True)] .groupby ([' Unnamed: 0']) .mean () print (data1)

Running result:

First of all, the data is extracted, and then the average value is obtained. I am in trouble here, because it is a year corresponding to a result. It's not an one-to-many relationship, so the following approach is better.

The related average value can also be obtained by using the mean method.

It's an achievement. It's not an one-to-many relationship, so the following approach is better.

The related average value can also be obtained by using the mean method.

The above is all the contents of this article "sample Analysis of Beijing College entrance examination score Statistics in Python". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Data scores fractional lines analysis statistics science liberal arts averages scores methods results one book college entrance examination code content data analysis articles runs examples Zhongbei Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS MariaDB Apple Docker vpn