In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you the R language crawling website data, the content is concise and easy to understand, it can definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Today, I saw that someone crawled the real estate information of Chengdu Station of Lianjia with Python. I tried to do the same thing with R, the specific code is as follows:
Library (rvest)
Url0%
Html_nodes ('div.where')% > html_nodes (' span.region')% >%
Html_text ()
B=web > html_nodes ('div.info-panel') > html_nodes (' div.area')
Are=rep (0dint length (b))
For (I in 1:length (b))
{
If (str_length (b [I]) > 60) {
Are [I] = b [I]% >% html_nodes ('span')% >% html_text ()
} else {
Are [I] = 0
}
}
Area=c (area,ifelse (are=='0','0',unlist (str_extract (are,' [0-9] + ~ [0-9] + | [0-9] +'))
A html_nodes ('div.info-panel') > html_nodes (' div.average')
Price=rep (0dint length (a))
For (I in 1:length (a))
{
If (str_length (a [I]) > 100) {
Price [I] = a [I]% >% html_nodes ('span.num')% >% html_text ()
} else {
Price [I] = 0
}
}
Price=c (price,price)
Type html_nodes ('div.info-panel') >%
Html_nodes ('div.type')% > html_nodes (' span.live')% >% html_text ()
Status html_nodes ('div.info-panel') >%
Html_nodes ('div.type')% > html_nodes (' span.onsold')% >% html_text ()
}
Data=data.frame (name,address,area,price=as.numeric (price), type,status)
DT::datatable (data)
Some of the results are as follows
Then we crawled and analyzed the new buildings in 17 cities, including Beijing, Shanghai, Shenzhen, Guangzhou and so on.
# Radar chart
# draw an area map
# # Bar Chart
# # hierarchical clustering
# # where is the real estate (some coordinates may be wrong, but the overall trend is OK)
The above content is R language crawling website data, have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.