A package to receive full-range daily Google Trends data
Project description
✨ DailyTrends 5.0 (final/stable) ✨
🚨 ALL BUGS FIXED🚨 - Update to version 5.0
- Fully operational after new versions of pandas broke the restructuring pipe.
- Google API change, so the code was adjusted (again).
- The timerange can now be specified approximately.
- The region (geo) can now be specified.
Purpose
This lightweight API solves the problem of getting only monthly-based data for large time series when collecting Google Trends data. No login required.
Installation
Install via PyPi:
$ pip install DailyTrends
Usage
>>> from DailyTrends.collect import collect_data
Queries are submitted in a gentle manner, which can be slow (but safe) for very large series.
>>> data = collect_data("AMD stock",start="2004-01-01", end="2019-07-06",
geo="", save=False, verbose=False)
>>> data.info()
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 5666 entries, 2004-01-01 to 2019-07-06
Freq: D
Data columns (total 1 columns):
AMD stock: (Worldwide) 5666 non-null float64
dtypes: float64(1)
memory usage: 88.5 KB
- The returned dataframe is already indexed and ready for storage/analysis.
- The end of the series defaults to "TODAY".
- The start of the series defaults to "2004-01-01".
- The geo parameter defaults to "", which yields global results.
# Plotting some rolling means of the daily data
>>> ax = data.rolling(10).mean().plot();
>>> data.rolling(25).mean().plot(ax=ax);
>>> data.rolling(50).mean().plot(ax=ax)
Add your own data
# In this case the historic prices of the stock
>>> import pandas as pd
>>> price_data = pd.read_csv("price_data.csv")
>>> merged = pd.merge(price_data, data,
left_index=True, right_index=True)
>>> merged[["AMD stock: (Worldwide)", "Open"]].rolling(30).mean().plot()
Load multiple queries
>>> data = collect_data(["Intel", "AMD"],start="2004-01-01", end="TODAY",
geo="DE", save=False, verbose=False)
To-Do
- Add Tor-Network-based requests
Disclaimer
This API is not supported by Google and is for experimental purposes only.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
DailyTrends-5.0.tar.gz
(6.0 kB
view details)
Built Distributions
DailyTrends-5.0-py3.9.egg
(12.2 kB
view details)
File details
Details for the file DailyTrends-5.0.tar.gz
.
File metadata
- Download URL: DailyTrends-5.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc45ae1efa1282759734d502b71638c19f5b36ad41b3ba3bba5da699a5d4cb62 |
|
MD5 | daad20292b5ae2d3796bf53e94d3fa1d |
|
BLAKE2b-256 | 96e68e5ca6863db3f466d165c7c3cebd7126b714b6b3b24313c0fcbbc0122f3f |
File details
Details for the file DailyTrends-5.0-py3.9.egg
.
File metadata
- Download URL: DailyTrends-5.0-py3.9.egg
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6244bfed033a614f7962c10a7a8eaf14a7bc72bea14c1419c97fa7e847edbcfd |
|
MD5 | aafcbdb24c89cd231d75232642b63c89 |
|
BLAKE2b-256 | a36d1c4496816161f6977d324522564214a9ed3993c95fe88c3b2b8abe16b709 |
File details
Details for the file DailyTrends-5.0-py3-none-any.whl
.
File metadata
- Download URL: DailyTrends-5.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20032d5de898f81a7911584a6de95142662189432691e7be8a4cf30f1cdf55e0 |
|
MD5 | cee7c3ac15f6ca1a22d12f0a910999ab |
|
BLAKE2b-256 | 89d29920f2f502251d11e568aa3fb3f7da7128a97c3ae693288bb6e8b5a904f9 |