tableau basic learning 2: time series data preprocessing and drawing

In this part, we record some analysis steps for analyzing time series trends

data preprocessing

1. Raw data

The original data is an excel form, which contains three Sheet pages,

Here we choose the stocks of two companies as time series data for comparison: Enjie Shares and HKUST Xunfei

insert image description here

insert image description here

2. Merge datasets

  1. First open the [Used Data Interpreter Cleanup] below, here you can automatically remove some useless rows to retain the data that needs to be analyzed
    insert image description here

  2. In tableau, double-click in the [Worksheet] on the left to add these two and automatically merge them

insert image description here
3. Manually adjust the link relationship and select the date to combine the same date data in the date column of the left table (HKUST Xunfei Table) and the date column of the right table (Enjie Shares) into one row, and take intersection

insert image description here

Here are four ways to merge:

  • Inside: take the intersection
  • Left side: Take what is in the left table, if the right table has it, merge it, and if the right table does not have it, it will be a null value (null)
  • Right side: Take what is in the right table, if the left table has it, merge it, and if the left table does not have it, it will be a null value (null)
  • Completely External: Take Union

2. Create a calculated field

Right-click on the title of the table below and select [Create Calculated Field] to get a new column added by calculation. This operation is the same as entering a new column in Excel. For example, add a column called "Closing Price Spread" =公式(xxxx), The following results are obtained:

insert image description here
This adds an extra column for subsequent analysis

Graphic analysis

1. Trend Analysis

Each of the same data items in the two tables can analyze the change trend. Here we analyze the correlation of the closing price trend:

  1. Select the density in the [Mark] area, we use the density map for analysis
  2. Drag the [closing price] of a table to the [column]
  3. Drag [Closing Price] of another table to [Row]
  4. Right-click the date and select the day (the default here is the year, resulting in only one point).
    insert image description here
    In the picture drawn like this, each point is the data of one day

Then we fine-tune:

  1. First left click [Size] and drag the size to the right
    insert image description here
  2. Then choose a color and choose a color that you think is OK:
    insert image description here
  3. Right-click in the table and select [Trend Line] -> [Show Trend Line],
    insert image description here
    then we can see the trend analysis results:
    insert image description here
    ps: You can add an additional filter. By selecting the time interval, the trend line will automatically change and fit the selection fixed time interval

2. Calculated field trend analysis

We use calculated fields to calculate two additional fields:

  • The difference between the highest price
  • The difference between the lowest price

Note: Due to the use of intersection data, this indicator will no longer distinguish between different stock codes, but directly get the calculation results of the two

Then draw the graph to get the following visualization effect:
insert image description here
According to the visualization effect, it can be seen that the trend of the difference between the highest price and the lowest price of the two stocks gradually diverges, which realizes the analysis of the combined data (calculation field)

Guess you like

Origin blog.csdn.net/weixin_35757704/article/details/132523826