Data cleaning—excel extracts the date data you want (for large amounts of data)

Foreword: When we do data processing or prediction, for example, the stock market only has data on a specific date. We need to analyze the impact of energy prices on stock prices. This involves several years and daily data (thousands of data points). We The time points of energy price data to be used are matched with the time points of stock prices. At this time, apply the VLOOKUP function of excel. The specific operations are as follows:

First: Do the date formats correspond to the same? When I was processing the data, I found that the period format was not what I wanted (Figure 1). Then we can "find and replace" and replace "-" with "/", as shown in Figure 2 , get Figure 3, which is the date format we want (you can also set other date formats yourself)

Figure 1: Raw data price format

 

Figure 2: Date replacement

 

Figure 3: Replacement results

Step 2: Now we need to find the corresponding energy price data based on the time corresponding to the price data. We use it in the price data table: =VLOOKUP(A2, national coal price!$A$1:$B$2150,2,0) .

A2: Indicates the location of the calculated data

National coal price!$A$1:$B$2150: Indicates the selected energy price data table

2: Because the second column is the data we are looking for, enter parameter 2

0: We have no other constraints here, so enter 0

Finally, the result in Figure 5 is obtained. The energy price and stock price data are corresponding according to time, and the data cleaning is completed.

 

 

Guess you like

Origin blog.csdn.net/weixin_50040016/article/details/127848854