In [2]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import datetime
In [3]:
df = pd.read_csv('time-series.csv')
In [4]:
df.head()
Out[4]:
Unnamed: 0
10-little-known-beaches-to-explore-in-the-last-days-of-summer
10-of-the-greatest-overland-migrations-photos
10-places-12-year-old-me-would-love-to-live
10-things-that-you-have-secretly-been-dying-to-know-about-the-world-of-hamilton
100-wonders-a-visit-with-a-frozen-dead-guy
100-wonders-an-island-you-dont-want-to-visit
100-wonders-battleship-island
100-wonders-blood-falls
100-wonders-clown-motel
...
you-can-buy-an-entire-village-in-england-for-28-million
you-can-now-take-your-pot-to-the-skies-in-oregon
you-still-have-time-to-apply-to-be-a-fulltime-ninja-in-japan
your-new-favorite-honey-is-made-out-of-bug-poop-and-bee-vomit
your-ticket-to-the-1893-columbian-exposition
youre-not-a-true-australian-until-youve-been-divebombed-by-a-magpie
youve-visited-100-countries-join-the-club
zeroes-after-zeroes-the-worlds-highest-currencies
zombie-mines-haunt-the-landscape
zzyzx-california-or-the-biggest-health-spa-scam-in-american-history
0
0
2.0
468.0
106.0
2186.0
928.0
168.0
1327.0
398.0
859.0
...
2097.0
279.0
753.0
959.0
382.0
551.0
1030.0
507.0
260.0
10500.0
1
1
419.0
368.0
762.0
538.0
272.0
236.0
705.0
251.0
381.0
...
NaN
1490.0
12084.0
616.0
168.0
203.0
467.0
1218.0
123.0
12072.0
2
2
203.0
658.0
271.0
209.0
231.0
65.0
110.0
27.0
78.0
...
NaN
1216.0
9798.0
369.0
38.0
68.0
96.0
935.0
77.0
3255.0
3
3
19.0
325.0
132.0
377.0
87.0
48.0
168.0
14.0
158.0
...
NaN
424.0
3809.0
164.0
28.0
31.0
41.0
235.0
44.0
1240.0
4
4
4.0
138.0
209.0
92.0
96.0
47.0
60.0
6.0
75.0
...
NaN
117.0
1548.0
41.0
17.0
19.0
19.0
217.0
13.0
815.0
5 rows × 3091 columns
In [5]:
df = df.drop('Unnamed: 0',axis=1)
In [6]:
df.head()
Out[6]:
10-little-known-beaches-to-explore-in-the-last-days-of-summer
10-of-the-greatest-overland-migrations-photos
10-places-12-year-old-me-would-love-to-live
10-things-that-you-have-secretly-been-dying-to-know-about-the-world-of-hamilton
100-wonders-a-visit-with-a-frozen-dead-guy
100-wonders-an-island-you-dont-want-to-visit
100-wonders-battleship-island
100-wonders-blood-falls
100-wonders-clown-motel
100-wonders-desertron
...
you-can-buy-an-entire-village-in-england-for-28-million
you-can-now-take-your-pot-to-the-skies-in-oregon
you-still-have-time-to-apply-to-be-a-fulltime-ninja-in-japan
your-new-favorite-honey-is-made-out-of-bug-poop-and-bee-vomit
your-ticket-to-the-1893-columbian-exposition
youre-not-a-true-australian-until-youve-been-divebombed-by-a-magpie
youve-visited-100-countries-join-the-club
zeroes-after-zeroes-the-worlds-highest-currencies
zombie-mines-haunt-the-landscape
zzyzx-california-or-the-biggest-health-spa-scam-in-american-history
0
2.0
468.0
106.0
2186.0
928.0
168.0
1327.0
398.0
859.0
828.0
...
2097.0
279.0
753.0
959.0
382.0
551.0
1030.0
507.0
260.0
10500.0
1
419.0
368.0
762.0
538.0
272.0
236.0
705.0
251.0
381.0
395.0
...
NaN
1490.0
12084.0
616.0
168.0
203.0
467.0
1218.0
123.0
12072.0
2
203.0
658.0
271.0
209.0
231.0
65.0
110.0
27.0
78.0
56.0
...
NaN
1216.0
9798.0
369.0
38.0
68.0
96.0
935.0
77.0
3255.0
3
19.0
325.0
132.0
377.0
87.0
48.0
168.0
14.0
158.0
56.0
...
NaN
424.0
3809.0
164.0
28.0
31.0
41.0
235.0
44.0
1240.0
4
4.0
138.0
209.0
92.0
96.0
47.0
60.0
6.0
75.0
94.0
...
NaN
117.0
1548.0
41.0
17.0
19.0
19.0
217.0
13.0
815.0
5 rows × 3090 columns
In [8]:
totals = df.sum()
In [11]:
totals = pd.DataFrame(totals)
In [12]:
totals.head()
Out[12]:
0
10-little-known-beaches-to-explore-in-the-last-days-of-summer
940.0
10-of-the-greatest-overland-migrations-photos
4826.0
10-places-12-year-old-me-would-love-to-live
4621.0
10-things-that-you-have-secretly-been-dying-to-know-about-the-world-of-hamilton
4482.0
100-wonders-a-visit-with-a-frozen-dead-guy
2032.0
In [14]:
dates = pd.read_csv('articles-by-dates.csv',header=None)
In [18]:
dates.set_index(0,inplace=True)
In [19]:
totals = totals.join(dates)
In [20]:
totals.head()
Out[20]:
0
1
10-little-known-beaches-to-explore-in-the-last-days-of-summer
940.0
2015-08-01
10-of-the-greatest-overland-migrations-photos
4826.0
2015-06-09
10-places-12-year-old-me-would-love-to-live
4621.0
2014-05-12
10-things-that-you-have-secretly-been-dying-to-know-about-the-world-of-hamilton
4482.0
2015-12-30
100-wonders-a-visit-with-a-frozen-dead-guy
2032.0
2016-01-07
In [ ]:
Content source: facemelters/data-science
Similar notebooks: