The rental information is already available. In order to have an intuitive understanding of the current rental market in Beijing, I conducted an in-depth analysis of the data and visualized it.

From the analysis results, I obtained important information such as where there are many housing listings, the average rental price in each district, and the geographical distribution of the desired price, which provides an important basis for helping me rent a house.

Let's take a look at the entire analysis process:

### 1. Analyze the number and unit price of houses in each administrative area

import pandas as pd beijing_daname=['Chaoyang District', 'Fengtai District', 'Haidian District', 'Daxing District', 'Tongzhou District', 'Changping District', 'Dongcheng Area', 'Xicheng District', 'Shunyi District'] data=pd.read_csv('Rental data plus latitude and longitude.csv',encoding='gbk') areas=list(set(list(data['Administrative area']))) area_sums={} for area in areas: area_sums[area]=list(data['Administrative area']).count(area) from pyecharts import options as opts from pyecharts.charts import Bar import random hotel_num=[area_sums[i] for i in beijing_daname] bar = ( Bar() .add_xaxis(beijing_daname) .add_yaxis("", hotel_num) .set_global_opts(title_opts=opts.TitleOpts(title="The number of houses in various districts of Beijing")) .set_series_opts( label_opts=opts.LabelOpts(is_show=True), markline_opts=opts.MarkLineOpts( data=[ opts.MarkLineItem(type_="min", name="minimum"), opts.MarkLineItem(type_="max", name="maximum value"), opts.MarkLineItem(type_="average", name="average value"), ] ), ) ) bar.render_notebook()

From the above figure the following conclusions can be drawn:

Chaoyang District has the largest number of housing listings.

There are 1877 houses in Shunyi District with the least number of houses.

There are 272 9 districts with an average of 611 listings.

The unit price of houses in each urban area (unit price per square meter * 30 square meters as an example)

unit_price={} for i in list(data.groupby('Administrative area')): if i[0] in beijing_daname: unit_price[i[0]]=int(i[1]['price'].sum()/i[1]['area'].sum())*30 unit_price bar = ( Bar() .add_xaxis(list(unit_price.keys())) .add_yaxis("", [unit_price[i] for i in list(unit_price.keys())]) .set_global_opts(title_opts=opts.TitleOpts(title="Average rental price in all districts of Beijing (unit price per square meter)*30 square meters as an example)")) .set_series_opts( label_opts=opts.LabelOpts(is_show=True), markline_opts=opts.MarkLineOpts( data=[ opts.MarkLineItem(type_="min", name="minimum"), opts.MarkLineItem(type_="max", name="maximum value"), opts.MarkLineItem(type_="average", name="average value"), ] ), ) ) bar.render_notebook()

Take 30 square meters as an example:

Housing prices are highest in Xicheng District

The lowest rental price in Tongzhou District is 4350 yuan

For 1620 yuan, the price gap is still very large

### 2. Analyze the proportion and price distribution of each household type

layouts=list(set(data['House type'])) layout=data.loc[:,'House type'].value_counts() from pyecharts import options as opts from pyecharts.charts import Pie print(list(layout.index)[:10]) values=[int(i) for i in list(layout.values)[:10]] pie = ( Pie() .add( "", [(i,j)for i,j in zip(list(layout.index)[:10],values)], radius=["30%", "75%"], center=["40%", "50%"], rosetype="radius", label_opts=opts.LabelOpts(is_show=False), ) .set_global_opts( title_opts=opts.TitleOpts(title="The proportion of rental units in each district of Beijing"), legend_opts=opts.LegendOpts(type_="scroll", pos_left="85%", orient="vertical"),) .set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c},{d}%")) ) pie.render_notebook()

Since there are many types of apartment types, I only selected the top 10 types. As can be seen from the picture, the mainstream of housing listings is 1 bedroom, 1 hall and 1 bathroom, accounting for 41.86%, followed by 2 bedrooms, 1 hall, 1 bathroom, and 1 bathroom. Room 0 hall 1 bathroom, accounting for 30.58% and 11.02% respectively

cut_n=list(range(0,12000,1000)) income=pd.cut(data["price"],cut_n) price_cut=data['price'].groupby(income).count() index=list(price_cut.index) index=[str(i) for i in list(price_cut.index)] values=[int(i) for i in list(price_cut.values)] pie = ( Pie() .add( "", [(i,j)for i,j in zip(index,values)], radius=["30%", "75%"], center=["40%", "50%"], rosetype="radius", label_opts=opts.LabelOpts(is_show=False), ) .set_global_opts( title_opts=opts.TitleOpts(title="The proportion of rental units in each district of Beijing"), legend_opts=opts.LegendOpts(type_="scroll", pos_left="85%", orient="vertical"),) .set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}, {d}%")) ) pie.render_notebook()

At present, the mainstream rental price is between 3,000 and 6,000 yuan, accounting for about 50% of the total. The cheapest one is less than 1,000 yuan, the location is relatively remote, and the area is less than 20 square meters; the expensive one is more than 10,000 yuan. This kind of general area Above 100 square meters, the location is in the main urban area.

### 3. House location distribution

Based on the above analysis and my budget, I decided to find a suitable house in Chaoyang District, take out the data with a price of 4,000 to 6,000 yuan, save the table, and import the table into the Shuijing Note Map Downloader

com_data=data[data['price'].le(6000)] com_data=com_data[com_data['price'].ge(3000)] com_data=com_data[com_data['Administrative area']=='Chaoyang District'] com_data.to_csv('Favorite house.csv',encoding='gbk')

The results are shown below:

The red number below is the rental price, so it is more convenient to find a house

Note: If you are looking for a high paying job in python. I suggest you write more real enterprise projects to gain experience. Otherwise, they will not be able to find jobs. Of course, many people have never entered the enterprise. How can there be project experience? So you need to look for enterprise projects to practice and practice more. If you are too lazy to look for it, you can also enter my Python communication circle: 1156465813. The group file contains some real enterprise project cases that I have written in development before. You can take it to study, you can find me in your skirt if you don’t understand, and I will patiently answer it for you when you have time.

The following content is useless, this blog is crawled and used by search engines

(*￣︶￣)(*￣︶￣)(*￣︶￣)(*￣︶￣)(*￣︶￣)(*￣︶￣)(*￣︶￣)(*￣︶￣)

What does python do? How long does it take to learn python from zero basics? Why is python called a crawler?

Python crawler rookie tutorial python crawler universal code python crawler how to make money

python basic tutorial web crawler python python crawler classic example

python crawler

(*￣︶￣)(*￣︶￣)(*￣︶￣)(*￣︶￣)(*￣︶￣)(*￣︶￣)(*￣︶￣)(*￣︶￣)

The above content is useless, it is used for this blog to be crawled by search engines