IntroductionΒΆ
Google Trends gives us an estimate of search volume. Let's explore if search popularity relates to other kinds of data. Perhaps there are patterns in Google's search volume and the price of Bitcoin or a hot stock like Tesla. Perhaps search volume for the term "Unemployment Benefits" can tell us something about the actual unemployment rate?
Data Sources:
Import StatementsΒΆ
Read the DataΒΆ
Data ExplorationΒΆ
TeslaΒΆ
Dataset ExplorationΒΆ
Examining the shape, column types, descriptive statistics, and periodicity of each dataset to establish the structure and time frequency before cleaning and resampling.
Tesla describe:
TSLA_WEB_SEARCH TSLA_USD_CLOSE
count 124.00 124.00
mean 8.73 50.96
std 5.87 65.91
min 2.00 3.90
25% 3.75 7.35
50% 8.00 44.65
75% 12.00 58.99
max 31.00 498.32
------------------------------------------------------------
Tesla info:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 124 entries, 0 to 123
Data columns (total 3 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 MONTH 124 non-null object
1 TSLA_WEB_SEARCH 124 non-null int64
2 TSLA_USD_CLOSE 124 non-null float64
dtypes: float64(1), int64(1), object(1)
memory usage: 3.0+ KB
None
Bitcoin search describe:
BTC_NEWS_SEARCH
count 73.00
mean 15.01
std 15.15
min 3.00
25% 5.00
50% 14.00
75% 18.00
max 100.00
------------------------------------------------------------
Bitcoin search info:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 73 entries, 0 to 72
Data columns (total 2 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 MONTH 73 non-null object
1 BTC_NEWS_SEARCH 73 non-null int64
dtypes: int64(1), object(1)
memory usage: 1.3+ KB
None
Bitcoin price head:
DATE CLOSE VOLUME
0 2014-09-17 457.33 21,056,800.00
1 2014-09-18 424.44 34,483,200.00
2 2014-09-19 394.80 37,919,700.00
3 2014-09-20 408.90 36,863,600.00
4 2014-09-21 398.82 26,580,100.00
------------------------------------------------------------
Bitcoin price info:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 2204 entries, 0 to 2203
Data columns (total 3 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 DATE 2204 non-null object
1 CLOSE 2203 non-null float64
2 VOLUME 2203 non-null float64
dtypes: float64(2), object(1)
memory usage: 51.8+ KB
None
------------------------------------------------------------
Bitcoin price describe:
CLOSE VOLUME
count 2,203.00 2,203.00
mean 4,429.42 8,043,622,390.14
std 4,148.15 11,765,285,602.39
min 178.10 5,914,570.00
25% 433.63 60,299,150.00
50% 3,637.52 2,018,889,984.00
75% 7,997.37 13,224,781,071.00
max 19,497.40 74,156,772,074.00
DF Unemployment head:
MONTH UE_BENEFITS_WEB_SEARCH UNRATE
0 2004-01 34 5.70
1 2004-02 33 5.60
2 2004-03 25 5.80
3 2004-04 29 5.60
4 2004-05 23 5.60
------------------------------------------------------------
Bitcoin price info:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 181 entries, 0 to 180
Data columns (total 3 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 MONTH 181 non-null object
1 UE_BENEFITS_WEB_SEARCH 181 non-null int64
2 UNRATE 181 non-null float64
dtypes: float64(1), int64(1), object(1)
memory usage: 4.4+ KB
None
------------------------------------------------------------
Bitcoin price describe:
UE_BENEFITS_WEB_SEARCH UNRATE
count 181.00 181.00
mean 35.11 6.22
std 20.48 1.89
min 14.00 3.70
25% 21.00 4.70
50% 26.00 5.40
75% 45.00 7.80
max 100.00 10.00
Largest value for Tesla in Web Search: 31 Smallest value for Tesla in Web Search: 2
Unemployment DataΒΆ
Largest value for "Unemployemnt Benefits" in Web Search: 100
BitcoinΒΆ
largest BTC News Search: 100
Data CleaningΒΆ
Check for Missing ValuesΒΆ
Missing Value CheckΒΆ
Checking each DataFrame for null entries before analysis. The Bitcoin price history contains one missing row that must be removed before resampling.
Missing values for Tesla?: MONTH 0 TSLA_WEB_SEARCH 0 TSLA_USD_CLOSE 0 dtype: int64 Missing values for U/E?: MONTH 0 UE_BENEFITS_WEB_SEARCH 0 UNRATE 0 dtype: int64 Missing values for BTC Search?: MONTH 0 BTC_NEWS_SEARCH 0 dtype: int64
| DATE | CLOSE | VOLUME | |
|---|---|---|---|
| 0 | 2014-09-17 | 457.33 | 21,056,800.00 |
| 1 | 2014-09-18 | 424.44 | 34,483,200.00 |
| 2 | 2014-09-19 | 394.80 | 37,919,700.00 |
| 3 | 2014-09-20 | 408.90 | 36,863,600.00 |
| 4 | 2014-09-21 | 398.82 | 26,580,100.00 |
Missing values for BTC price?: DATE 0 CLOSE 1 VOLUME 1 dtype: int64
take a closer look at the missing values in BTC price:
DATE CLOSE VOLUME
2148 2020-08-04 NaN NaN
Number of missing values: 2
Dropping Missing ValuesΒΆ
Dropping the single null row identified in the Bitcoin price data to produce a clean, complete time series before the resampling step.
Number of missing values: 0
Converting Date Strings to DatetimeΒΆ
All date columns arrive as plain strings. Converting them to pandas Timestamp objects enables resampling, rolling windows, and Matplotlib date formatting on the time axis.
df_tesla MONTH dtype: datetime64[ns] sample value type: <class 'pandas._libs.tslibs.timestamps.Timestamp'> df_btc_price DATE dtype: datetime64[ns] sample value type: <class 'pandas._libs.tslibs.timestamps.Timestamp'> df_btc_search MONTH dtype: datetime64[ns] sample value type: <class 'pandas._libs.tslibs.timestamps.Timestamp'> df_unemployment MONTH dtype: datetime64[ns] sample value type: <class 'pandas._libs.tslibs.timestamps.Timestamp'>
Converting from Daily to Monthly DataΒΆ
| DATE | CLOSE | VOLUME | |
|---|---|---|---|
| 0 | 2014-09-17 | 457.33 | 21,056,800.00 |
| 1 | 2014-09-18 | 424.44 | 34,483,200.00 |
| 2 | 2014-09-19 | 394.80 | 37,919,700.00 |
| 3 | 2014-09-20 | 408.90 | 36,863,600.00 |
| 4 | 2014-09-21 | 398.82 | 26,580,100.00 |
(73, 2)
| CLOSE | VOLUME | |
|---|---|---|
| DATE | ||
| 2014-09-30 | 386.94 | 34,707,300.00 |
| 2014-10-31 | 338.32 | 12,545,400.00 |
| 2014-11-30 | 378.05 | 9,194,440.00 |
| 2014-12-31 | 320.19 | 13,942,900.00 |
| 2015-01-31 | 217.46 | 23,348,200.00 |
Data VisualisationΒΆ
Notebook Formatting & Style HelpersΒΆ
Tesla Stock Price v.s. Search VolumeΒΆ
Tesla: Initial Dual-Axis ChartΒΆ
Plotting Tesla stock price against Google search volume on two independent y-axes using twinx() β the first visual test of whether the two signals share any visible pattern over the same period.
Tesla: Colour-Coded Dual-Axis ChartΒΆ
Applying colour coding to distinguish the two signals β red for stock price, blue for search volume β and matching axis label colours to their corresponding lines for immediate visual association.
Tesla: Final Styled ChartΒΆ
Refining the chart with larger figure size, increased font sizes, axis limits, thicker lines, rotated tick labels, and explicit x-axis bounds for a clean, production-ready layout.
How to add tick formatting for dates on the x-axis.
Bitcoin (BTC) Price v.s. Search VolumeΒΆ
Bitcoin: Price vs. Search VolumeΒΆ
Comparing resampled month-end Bitcoin prices against monthly search volume on a dual-axis chart. A dashed line for price and circle markers for search visually separate the two signals and make the lead-lag relationship easier to read.
| MONTH | BTC_NEWS_SEARCH | |
|---|---|---|
| count | 73 | 73.00 |
| mean | 2017-08-31 09:32:03.287671296 | 15.01 |
| min | 2014-09-01 00:00:00 | 3.00 |
| 25% | 2016-03-01 00:00:00 | 5.00 |
| 50% | 2017-09-01 00:00:00 | 14.00 |
| 75% | 2019-03-01 00:00:00 | 18.00 |
| max | 2020-09-01 00:00:00 | 100.00 |
| std | NaN | 15.15 |
Unemployement Benefits Search vs. Actual Unemployment in the U.S.ΒΆ
Unemployment: Search vs. Rate (2004β2019)ΒΆ
Plotting 'unemployment benefits' search interest against the official FRED unemployment rate on a dual-axis chart. A grey dashed grid aids reading across the long time axis and surfaces the seasonal search pattern that recurs each year.
| MONTH | UE_BENEFITS_WEB_SEARCH | UNRATE | |
|---|---|---|---|
| count | 181 | 181.00 | 181.00 |
| mean | 2011-07-02 01:51:22.872928256 | 35.11 | 6.22 |
| min | 2004-01-01 00:00:00 | 14.00 | 3.70 |
| 25% | 2007-10-01 00:00:00 | 21.00 | 4.70 |
| 50% | 2011-07-01 00:00:00 | 26.00 | 5.40 |
| 75% | 2015-04-01 00:00:00 | 45.00 | 7.80 |
| max | 2019-01-01 00:00:00 | 100.00 | 10.00 |
| std | NaN | 20.48 | 1.89 |
Unemployment: 6-Month Rolling AverageΒΆ
Applying a 6-month rolling mean to the unemployment search data smooths out seasonal spikes. The smoothed signal exposes the structural employment trend beneath the noise β and shows more clearly which series moves first.
| MONTH | UE_BENEFITS_WEB_SEARCH | UE_SEARCH_6M_AVG | |
|---|---|---|---|
| 0 | 2004-01-01 | 34 | NaN |
| 1 | 2004-02-01 | 33 | NaN |
| 2 | 2004-03-01 | 25 | NaN |
| 3 | 2004-04-01 | 29 | NaN |
| 4 | 2004-05-01 | 23 | NaN |
| 5 | 2004-06-01 | 29 | 28.83 |
| 6 | 2004-07-01 | 26 | 27.50 |
| 7 | 2004-08-01 | 26 | 26.33 |
| 8 | 2004-09-01 | 23 | 26.00 |
| 9 | 2004-10-01 | 26 | 25.50 |
Including 2020 in Unemployment ChartsΒΆ
Unemployment: Adding the 2020 COVID DatasetΒΆ
Extending the dataset through 2020 captures the COVID-19 shock. Adding this data also triggers Google Trends normalisation β index values are rescaled to 100 within the new time window, compressing the entire 2004β2019 baseline.
| MONTH | UE_BENEFITS_WEB_SEARCH | UNRATE | |
|---|---|---|---|
| 0 | 2004-01-01 | 9 | 5.70 |
| 1 | 2004-02-01 | 8 | 5.60 |
| 2 | 2004-03-01 | 7 | 5.80 |
| 3 | 2004-04-01 | 8 | 5.60 |
| 4 | 2004-05-01 | 6 | 5.60 |
Key FindingsΒΆ
COVID-19 unemployment shock (2020)
The 2020 dataset compresses a pattern that normally unfolds over quarters into a matter of weeks. Search interest for 'unemployment benefits' and the official FRED unemployment rate spiked simultaneously β not sequentially. Adding the 2020 data also rescales all historical Trends values through normalisation, which means the pre-2020 baseline shifts when the new period is included. This is a real data integrity consideration, not a display artefact.
Bitcoin search leads price in some cycles
Search volume and Bitcoin price move together during peak speculation periods but diverge during consolidation. In several cycles, search interest reached its maximum one to two months before price did, suggesting public attention can precede price discovery in momentum-driven markets.
Tesla search tracks news events, not earnings
Tesla search volume spikes align more closely with product announcements and public controversy than with earnings beats. Strong earnings quarters often show no corresponding increase in search interest, while high-profile events β model reveals, regulatory headlines, executive actions β produce clearly visible spikes.
Rolling average reveals structural unemployment trend
The 6-month rolling average removes the recurring seasonal search spikes and makes the slower-moving structural employment cycle visible. The smoothed curve tracks the official unemployment rate more closely than the raw monthly data and makes the underlying trend direction unambiguous.