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

Commit e359a96

Browse files
author
tylerhutcherson
committed
update notebook template
1 parent 8b470d2 commit e359a96

File tree

1 file changed

+19
-27
lines changed

1 file changed

+19
-27
lines changed

bitcoinRNN.ipynb

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"cell_type": "code",
55
"execution_count": 1,
66
"metadata": {
7-
"collapsed": false,
87
"scrolled": true
98
},
109
"outputs": [
@@ -39,7 +38,6 @@
3938
"cell_type": "code",
4039
"execution_count": 2,
4140
"metadata": {
42-
"collapsed": false,
4341
"scrolled": true
4442
},
4543
"outputs": [
@@ -126,9 +124,7 @@
126124
{
127125
"cell_type": "code",
128126
"execution_count": 163,
129-
"metadata": {
130-
"collapsed": false
131-
},
127+
"metadata": {},
132128
"outputs": [
133129
{
134130
"name": "stdout",
@@ -172,9 +168,7 @@
172168
{
173169
"cell_type": "code",
174170
"execution_count": 164,
175-
"metadata": {
176-
"collapsed": false
177-
},
171+
"metadata": {},
178172
"outputs": [
179173
{
180174
"name": "stdout",
@@ -196,9 +190,7 @@
196190
{
197191
"cell_type": "code",
198192
"execution_count": 165,
199-
"metadata": {
200-
"collapsed": false
201-
},
193+
"metadata": {},
202194
"outputs": [
203195
{
204196
"name": "stdout",
@@ -215,11 +207,19 @@
215207
"print(\"Validating a single record:\", flush=True)\n",
216208
"print(gtrends_json['data'][0], flush=True)\n",
217209
"\n",
218-
"# Convert to pandas df and handle string NaN's coming through data engine\n",
210+
"# Convert to pandas df\n",
219211
"gtrends = pd.DataFrame.from_records(gtrends_json['data'])\\\n",
220-
" .pivot(index='date', values='interest', columns='keyword')\\\n",
221-
" .replace({'NaN': None})\\\n",
222-
" .fillna(method='pad')\n",
212+
" .pivot(index='date', values='interest', columns='keyword')\n",
213+
"\n",
214+
"# Deal with potential nans\n",
215+
"for col in gtrends.columns:\n",
216+
" if 'NaN' in gtrends[col].values:\n",
217+
" gtrends[col].replace({'NaN': None}, inplace=True)\n",
218+
" else:\n",
219+
" continue\n",
220+
"\n",
221+
"# If there are nans, fill using pad method\n",
222+
"gtrends.fillna(method='pad', inplace=True)\n",
223223
"\n",
224224
"# Set proper date format\n",
225225
"gtrends.index = pd.to_datetime(gtrends.index)\n",
@@ -231,9 +231,7 @@
231231
{
232232
"cell_type": "code",
233233
"execution_count": 108,
234-
"metadata": {
235-
"collapsed": false
236-
},
234+
"metadata": {},
237235
"outputs": [
238236
{
239237
"name": "stdout",
@@ -339,9 +337,7 @@
339337
{
340338
"cell_type": "code",
341339
"execution_count": 140,
342-
"metadata": {
343-
"collapsed": false
344-
},
340+
"metadata": {},
345341
"outputs": [
346342
{
347343
"name": "stdout",
@@ -501,9 +497,7 @@
501497
{
502498
"cell_type": "code",
503499
"execution_count": 143,
504-
"metadata": {
505-
"collapsed": false
506-
},
500+
"metadata": {},
507501
"outputs": [
508502
{
509503
"name": "stdout",
@@ -562,9 +556,7 @@
562556
{
563557
"cell_type": "code",
564558
"execution_count": 162,
565-
"metadata": {
566-
"collapsed": false
567-
},
559+
"metadata": {},
568560
"outputs": [
569561
{
570562
"name": "stdout",

0 commit comments

Comments
 (0)