Skip to content
This repository was archived by the owner on Jun 12, 2019. It is now read-only.

Commit 256e444

Browse files
author
Tyler Hutcherson
authored
fix data condition on gtrends
1 parent 95682be commit 256e444

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

main.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@
4848
print("Validating a single record:", flush=True)
4949
print(gtrends_json['data'][0], flush=True)
5050

51-
# Convert to pandas df
52-
gtrends = pd.DataFrame.from_records(gtrends_json['data']) .pivot(index='date', values='interest', columns='keyword')
51+
# Convert to pandas df and handles string NaN's coming through data engine
52+
gtrends = pd.DataFrame.from_records(gtrends_json['data'])\
53+
.pivot(index='date', values='interest', columns='keyword')\
54+
.replace({'NaN': None})\
55+
.fillna(method='pad')
5356

5457
# Set proper date format
5558
gtrends.index = pd.to_datetime(gtrends.index)

0 commit comments

Comments
 (0)