Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to analyze the growth of TopN

Shulou Source: shulou.com Published: 2022-06-01 02:02:02 10月02日 Update

This article shows you how to analyze the growth of TopN, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

For example, if we understand the increase in PM2.5, which is the most polluted three days of the year, we can see whether serious pollution occurs suddenly or accumulates gradually. It is not difficult to use the SQL statement to identify the three most polluted days:

Select top 3 * from T order by pm25 desc

But the following steps are more troublesome, to find the day before these three days, but also to do calculations with the previous day's values, if not a SQL master, you really can't write this SQL correctly.

If you use the aggregator SPL language to describe this calculation process, it will be clearer to get the original data from the database:

> T=connect ("mysqlDB") .query ("select * from T")

Then one line of code takes care of the entire calculation requirement:

> t3=T.ptop (- 3, pm25), t3=t3.run (~ = T (~) .pm25 / T (~-1) .pm25-1)

This is mainly due to the fact that SPL language supports ordered set computing, so it is easy to get the position of the data in the set, and it is also easy to check the data through the relative / absolute position.

The above is how to analyze the growth of TopN. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Tags: Data pollution situation analysis growth location content skills growth knowledge language primitive orderly concise concise one line code that is numerical values databases Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno macOS MariaDB Linux Microsoft