Exploratory Data Analysis and Cleaning

available at:

https://dl.dropboxusercontent.com/u/75194/ac297rtut2.ipynb

In [1]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
pd.set_option('display.width', 500)
pd.set_option('display.max_columns', 100)

Pandas

In [70]:
df=pd.read_csv("https://dl.dropboxusercontent.com/u/75194/all.csv", header=None,
               names=["rating", 'review_count', 'isbn', 'booktype','author_url', 'year', 'genre_urls', 'dir','rating_count', 'name'],
)
df.head()
Out[70]:
rating review_count isbn booktype author_url year genre_urls dir rating_count name
0 4.40 136455 0439023483 good_reads:book https://www.goodreads.com/author/show/153394.S... 2008 /genres/young-adult|/genres/science-fiction|/g... dir01/2767052-the-hunger-games.html 2958974 The Hunger Games (The Hunger Games, #1)
1 4.41 16648 0439358078 good_reads:book https://www.goodreads.com/author/show/1077326.... 2003 /genres/fantasy|/genres/young-adult|/genres/fi... dir01/2.Harry_Potter_and_the_Order_of_the_Phoe... 1284478 Harry Potter and the Order of the Phoenix (Har...
2 3.56 85746 0316015849 good_reads:book https://www.goodreads.com/author/show/941441.S... 2005 /genres/young-adult|/genres/fantasy|/genres/ro... dir01/41865.Twilight.html 2579564 Twilight (Twilight, #1)
3 4.23 47906 0061120081 good_reads:book https://www.goodreads.com/author/show/1825.Har... 1960 /genres/classics|/genres/fiction|/genres/histo... dir01/2657.To_Kill_a_Mockingbird.html 2078123 To Kill a Mockingbird
4 4.23 34772 0679783261 good_reads:book https://www.goodreads.com/author/show/1265.Jan... 1813 /genres/classics|/genres/fiction|/genres/roman... dir01/1885.Pride_and_Prejudice.html 1388992 Pride and Prejudice

Notice we have a table! A spreadsheet! And it indexed the rows. Lets see the types of the columns...

In [3]:
df.dtypes
Out[3]:
rating          float64
review_count     object
isbn             object
booktype         object
author_url       object
year            float64
genre_urls       object
dir              object
rating_count     object
name             object
dtype: object
In [4]:
df.shape
Out[4]:
(6000, 10)
In [5]:
df.columns
Out[5]:
Index([u'rating', u'review_count', u'isbn', u'booktype', u'author_url', u'year', u'genre_urls', u'dir', u'rating_count', u'name'], dtype='object')
In [6]:
df.rating[df.rating.isnull()]
Out[6]:
3643   NaN
5282   NaN
Name: rating, dtype: float64

One can convert to numpy arrays

In [7]:
vals=df.rating[df.rating.notnull()].values
print type(vals)
vals
<type 'numpy.ndarray'>
Out[7]:
array([ 4.4 ,  4.41,  3.56, ...,  3.78,  3.91,  4.35])

But one dosent have to

In [9]:
df.rating.hist();

More cleaning

In [10]:
df[df.year.isnull()]
Out[10]:
rating review_count isbn booktype author_url year genre_urls dir rating_count name
2442 4.23 526 NaN good_reads:book https://www.goodreads.com/author/show/623606.A... NaN /genres/religion|/genres/islam|/genres/non-fic... dir25/1301625.La_Tahzan.html 4134 La Tahzan
2869 4.61 2 NaN good_reads:book https://www.goodreads.com/author/show/8182217.... NaN NaN dir29/22031070-my-death-experiences---a-preach... 23 My Death Experiences - A Preacher’s 18 Apoca...
3643 NaN None None None None NaN NaN dir37/9658936-harry-potter.html None None
5282 NaN None None None None NaN NaN dir53/113138.The_Winner.html None None
5572 3.71 35 8423336603 good_reads:book https://www.goodreads.com/author/show/285658.E... NaN /genres/fiction dir56/890680._rase_una_vez_el_amor_pero_tuve_q... 403 Érase una vez el amor pero tuve que matarlo. ...
5658 4.32 44 NaN good_reads:book https://www.goodreads.com/author/show/25307.Ro... NaN /genres/fantasy|/genres/fantasy|/genres/epic-f... dir57/5533041-assassin-s-apprentice-royal-assa... 3850 Assassin's Apprentice / Royal Assassin (Farsee...
5683 4.56 204 NaN good_reads:book https://www.goodreads.com/author/show/3097905.... NaN /genres/fantasy|/genres/young-adult|/genres/ro... dir57/12474623-tiger-s-dream.html 895 Tiger's Dream (The Tiger Saga, #5)
In [11]:
df = df[df.year.notnull()]
In [12]:
df.shape
Out[12]:
(5993, 10)
In [13]:
df.rating_count=df.rating_count.astype(int)
df.review_count=df.review_count.astype(int)
df.year=df.year.astype(int)
In [14]:
df.dtypes
Out[14]:
rating          float64
review_count      int64
isbn             object
booktype         object
author_url       object
year              int64
genre_urls       object
dir              object
rating_count      int64
name             object
dtype: object
In [15]:
df[df.genre_urls.isnull()]
Out[15]:
rating review_count isbn booktype author_url year genre_urls dir rating_count name
953 4.56 27 1477276068 good_reads:book https://www.goodreads.com/author/show/6621980.... 2012 NaN dir10/16243767-crossing-the-seas.html 90 Crossing the Seas
1515 4.56 8 NaN good_reads:book https://www.goodreads.com/author/show/394525.T... 2013 NaN dir16/18136407-crashing-down-to-earth.html 75 Crashing Down to Earth
1693 4.21 7 NaN good_reads:book https://www.goodreads.com/author/show/3110785._ 2009 NaN dir17/7425765.html 67 Слънце недосегаемо
1752 3.85 41 140921818X good_reads:book https://www.goodreads.com/author/show/7337562.... 13 NaN dir18/5548850-the-day-jesus-rode-into-croydon.... 94 The Day Jesus Rode Into Croydon
1942 4.66 8 0992382009 good_reads:book https://www.goodreads.com/author/show/7574275.... 2014 NaN dir20/19532388-letters-from-your-soul.html 29 Letters from your soul
2034 4.92 2 147930414X good_reads:book https://www.goodreads.com/author/show/6467808.... 2012 NaN dir21/20363899-happy-halloween.html 49 Happy Halloween
2067 4.16 24 0804844399 good_reads:book https://www.goodreads.com/author/show/6894841.... 2012 NaN dir21/18343754-a-capitalist-in-north-korea.html 57 A Capitalist in North Korea
2145 5.00 3 1300589469 good_reads:book https://www.goodreads.com/author/show/6906561.... 2012 NaN dir22/17287259-a-book-about-absolutely-nothing... 63 A Book About Absolutely Nothing.
2170 4.65 12 NaN good_reads:book https://www.goodreads.com/author/show/6565853.... 2012 NaN dir22/17904495-curse-of-the-salute.html 31 Curse of The Salute
2190 4.33 31 0987434853 good_reads:book https://www.goodreads.com/author/show/4443219.... 2013 NaN dir22/18251020-life-song.html 40 Life Song
2476 3.53 3 NaN good_reads:book https://www.goodreads.com/author/show/5139623.... 2013 NaN dir25/17563755-miscellaneous-stuff-stuff.html 15 Miscellaneous Stuff & Stuff
2734 4.08 5095 0192833987 good_reads:book https://www.goodreads.com/author/show/128382.L... 1869 NaN dir28/656.War_and_Peace.html 117775 War and Peace
2865 4.93 0 9789898541 good_reads:book https://www.goodreads.com/author/show/7458878.... 2012 NaN dir29/19065420-la-os-fortes-e-decis-es-dif-cei... 14 Laços fortes e decisões difíceis
2868 4.94 6 NaN good_reads:book https://www.goodreads.com/author/show/8127793.... 2014 NaN dir29/21864814-nik-nassa-the-mark-of-destiny.html 16 Nik Nassa & the Mark of Destiny
2877 3.53 10 NaN good_reads:book https://www.goodreads.com/author/show/8193887.... 2014 NaN dir29/22174792.html 19 الصوت روح
2903 5.00 0 0983002282 good_reads:book https://www.goodreads.com/author/show/6589034.... 2012 NaN dir30/17608096-obscured-darkness.html 8 Obscured Darkness (Family Secrets #2)
2909 5.00 0 0983002215 good_reads:book https://www.goodreads.com/author/show/6589034.... 2011 NaN dir30/16200303-family-secrets.html 9 Family Secrets
2920 4.93 6 1453634819 good_reads:book https://www.goodreads.com/author/show/4808225.... 2010 NaN dir30/11187861-the-years-distilled.html 28 The Years Distilled
2928 4.73 1 0983002274 good_reads:book https://www.goodreads.com/author/show/6589034.... 2012 NaN dir30/16173867-mortal.html 11 Mortal
3225 4.00 0 NaN good_reads:book https://www.goodreads.com/author/show/6520851.... 2012 NaN dir33/15992396-take-a-deep-breath---21-top-tip... 11 Take a Deep Breath - 21 Top Tips for Relaxed, ...
3229 4.40 19 1625108737 good_reads:book https://www.goodreads.com/author/show/6978127.... 2013 NaN dir33/17871711-the-mystery-of-revenge.html 55 The Mystery of Revenge
3238 4.35 20 NaN good_reads:book https://www.goodreads.com/author/show/7243654.... 2013 NaN dir33/18397370-the-real-book-of-the-dead.html 40 The Real Book of the Dead
3258 4.63 20 NaN good_reads:book https://www.goodreads.com/author/show/7058502.... 2013 NaN dir33/19571104-the-keeper.html 54 The Keeper (The Keeper, #3)
3289 4.61 4 NaN good_reads:book https://www.goodreads.com/author/show/7243654.... 2013 NaN dir33/18626461-messages-from-heaven.html 31 Messages From Heaven
3688 4.53 9 NaN good_reads:book https://www.goodreads.com/author/show/6440482.... 2012 NaN dir37/15745506-the-oaks.html 19 The Oaks (Royal Oaks, #1)
3786 4.00 4 NaN good_reads:book https://www.goodreads.com/author/show/7843984.... 2014 NaN dir38/22049639-the-eagle-s-secret.html 28 The Eagle's Secret
3803 3.98 8 1608622835 good_reads:book https://www.goodreads.com/author/show/4875841.... 2011 NaN dir39/11451865-hillbilly-tales-from-the-smoky-... 40 Hillbilly Tales from the Smoky Mountains - And...
3868 4.43 1 1606191934 good_reads:book https://www.goodreads.com/author/show/2941486.... 2012 NaN dir39/15894829-the-case-of-the-cosmological-ki... 30 The Case of the Cosmological Killer (Displaced...
4383 4.29 2 NaN good_reads:book https://www.goodreads.com/author/show/5077755.... 2011 NaN dir44/12260642-i-am-an-island.html 14 I am an Island
4384 4.06 6 NaN good_reads:book https://www.goodreads.com/author/show/5831594.... 2012 NaN dir44/13638968-undying.html 32 Undying (Undying, #1)
4387 4.36 5 1494884631 good_reads:book https://www.goodreads.com/author/show/7754245.... 2014 NaN dir44/20497446-it-s-not-what-you-think.html 14 It's Not What You Think (It's Not What You Thi...
4389 4.29 9 NaN good_reads:book https://www.goodreads.com/author/show/7801640.... 2013 NaN dir44/20578084-we-got-zombies-on-the-lawn-agai... 14 We Got Zombies On The Lawn Again, Ma (Ax Hande...
4405 4.88 1 NaN good_reads:book https://www.goodreads.com/author/show/8433703.... 2014 NaN dir45/22884686-my-two-cents.html 8 My Two Cents
4410 4.37 11 NaN good_reads:book https://www.goodreads.com/author/show/7380017.... 2013 NaN dir45/18769784-hard-up-ardon-1.html 27 Hard Up, Ardon #1
4472 4.79 5 NaN good_reads:book https://www.goodreads.com/author/show/6585024.... 2013 NaN dir45/18081150-tilt.html 14 Tilt (Dreams of Chaos #2)
4473 5.00 0 NaN good_reads:book https://www.goodreads.com/author/show/6896621.... 2012 NaN dir45/17259227-patience-s-love.html 7 Patience's Love
4524 4.46 2 NaN good_reads:book https://www.goodreads.com/author/show/4808225.... 2011 NaN dir46/11187936-fresh.html 24 Fresh
4763 4.56 8 NaN good_reads:book https://www.goodreads.com/author/show/4087195.... 2010 NaN dir48/8466114-in-the-name-of-revenge.html 16 In the Name of Revenge (Ivanovich, #1)
5411 4.25 3 1450556566 good_reads:book https://www.goodreads.com/author/show/3335237.... 2010 NaN dir55/8176759-a-terrace-on-the-tower-of-babel.... 12 A Terrace On The Tower Of Babel
5429 4.45 5 NaN good_reads:book https://www.goodreads.com/author/show/7373870.... 2013 NaN dir55/18752404-it-comes-natural---understandin... 11 It Comes Natural - Understanding Natural and I...
5433 4.60 3 NaN good_reads:book https://www.goodreads.com/author/show/8187644.... 2014 NaN dir55/22038750-new-zigon---the-founder-s-curse... 5 New Zigon - The Founder's Curse
5435 4.48 6 NaN good_reads:book https://www.goodreads.com/author/show/5132169.... 2014 NaN dir55/22671084-bound-anthology.html 23 Bound Anthology
5443 4.15 14 0982816308 good_reads:book https://www.goodreads.com/author/show/4524500.... 2010 NaN dir55/9972090-secrets-of-jewish-wealth-reveale... 61 Secrets of Jewish Wealth Revealed!
5458 4.25 3 1311059164 good_reads:book https://www.goodreads.com/author/show/8507331.... 2014 NaN dir55/23118840-liliana.html 8 Liliana
5479 4.66 4 NaN good_reads:book https://www.goodreads.com/author/show/7456408.... 2013 NaN dir55/19055068-churning-waters.html 32 Churning Waters
5480 4.83 3 1495416739 good_reads:book https://www.goodreads.com/author/show/7399883.... 2014 NaN dir55/20773953-this-land-of-streams.html 6 This Land of Streams
5494 3.81 7 NaN good_reads:book https://www.goodreads.com/author/show/5077755.... 2008 NaN dir55/12260599-huey-lambert-s-walking-nuclear-... 16 Huey Lambert's Walking Nuclear Circus
5498 4.80 34 1933455098 good_reads:book https://www.goodreads.com/author/show/5834131.... 2012 NaN dir55/13645330-syrian-folktales.html 50 Syrian Folktales
5500 4.71 12 NaN good_reads:book https://www.goodreads.com/author/show/5895074.... 2011 NaN dir56/16075193-fantacia.html 31 Fantacia (Voxian, #1)
5516 4.62 12 0974056049 good_reads:book https://www.goodreads.com/author/show/503388.B... 2006 NaN dir56/6319131-the-peace-of-the-spirit-within.html 68 The Peace of the Spirit Within
5532 4.86 4 1477504540 good_reads:book https://www.goodreads.com/author/show/5989528.... 2013 NaN dir56/17695243-call-of-the-lost-ages.html 7 Call Of The Lost Ages
5560 4.00 1 NaN good_reads:book https://www.goodreads.com/author/show/7518486._ 2013 NaN dir56/21569585.html 10 اموال ودماء
5565 4.50 5 NaN good_reads:book https://www.goodreads.com/author/show/8262567.... 2014 NaN dir56/22524731-five-years---the-meeting.html 10 Five Years - The Meeting
5584 4.75 3 1481959824 good_reads:book https://www.goodreads.com/author/show/5100743.... 2013 NaN dir56/17606460-why-not-world.html 8 Why Not-World
5618 4.44 4 1495907791 good_reads:book https://www.goodreads.com/author/show/7399883.... 2014 NaN dir57/20835408-the-afternoon-when-she-died.html 9 The Afternoon When She Died
5692 5.00 0 NaN good_reads:book https://www.goodreads.com/author/show/5989528.... 2012 NaN dir57/14288412-abstraction-in-theory---laws-of... 6 Abstraction In Theory - Laws Of Physical Trans...
5717 4.71 4 NaN good_reads:book https://www.goodreads.com/author/show/5838022.... 2012 NaN dir58/13741511-american-amaranth.html 14 American Amaranth
5729 4.83 16 NaN good_reads:book https://www.goodreads.com/author/show/7058502.... 2014 NaN dir58/22312293-the-keeper.html 29 The Keeper (The Keeper, #5)
5778 4.63 0 NaN good_reads:book https://www.goodreads.com/author/show/4808225.... 2010 NaN dir58/11187937-un-spoken.html 19 (Un) Spoken
In [16]:
df.genre_urls[df.genre_urls.isnull()]=""
df.isbn[df.isbn.isnull()]=""
In [17]:
df[df.genre_urls.isnull()]
Out[17]:
rating review_count isbn booktype author_url year genre_urls dir rating_count name
In [18]:
df[df.author_url.isnull()]
Out[18]:
rating review_count isbn booktype author_url year genre_urls dir rating_count name
In [19]:
df[df.booktype.isnull()]
Out[19]:
rating review_count isbn booktype author_url year genre_urls dir rating_count name
In [20]:
df.dtypes
Out[20]:
rating          float64
review_count      int64
isbn             object
booktype         object
author_url       object
year              int64
genre_urls       object
dir              object
rating_count      int64
name             object
dtype: object
In [21]:
df['author']=df.author_url.map(lambda x: ".".join(x.split('/')[-1].split('.')[1:]))
df['booktype']=df.booktype.map(lambda x: x.split(':')[-1])
In [22]:
def saj(item):
    genres=item.split('|')
    genres=[e.split('/')[-1] for e in genres]
    return "|".join(genres)

df['genres']=df.genre_urls.map(saj)
df.head()
Out[22]:
rating review_count isbn booktype author_url year genre_urls dir rating_count name author genres
0 4.40 136455 0439023483 book https://www.goodreads.com/author/show/153394.S... 2008 /genres/young-adult|/genres/science-fiction|/g... dir01/2767052-the-hunger-games.html 2958974 The Hunger Games (The Hunger Games, #1) Suzanne_Collins young-adult|science-fiction|dystopia|fantasy|s...
1 4.41 16648 0439358078 book https://www.goodreads.com/author/show/1077326.... 2003 /genres/fantasy|/genres/young-adult|/genres/fi... dir01/2.Harry_Potter_and_the_Order_of_the_Phoe... 1284478 Harry Potter and the Order of the Phoenix (Har... J_K_Rowling fantasy|young-adult|fiction|fantasy|magic|chil...
2 3.56 85746 0316015849 book https://www.goodreads.com/author/show/941441.S... 2005 /genres/young-adult|/genres/fantasy|/genres/ro... dir01/41865.Twilight.html 2579564 Twilight (Twilight, #1) Stephenie_Meyer young-adult|fantasy|romance|paranormal|vampire...
3 4.23 47906 0061120081 book https://www.goodreads.com/author/show/1825.Har... 1960 /genres/classics|/genres/fiction|/genres/histo... dir01/2657.To_Kill_a_Mockingbird.html 2078123 To Kill a Mockingbird Harper_Lee classics|fiction|historical-fiction|academic|s...
4 4.23 34772 0679783261 book https://www.goodreads.com/author/show/1265.Jan... 1813 /genres/classics|/genres/fiction|/genres/roman... dir01/1885.Pride_and_Prejudice.html 1388992 Pride and Prejudice Jane_Austen classics|fiction|romance|historical-fiction|li...
In [23]:
df[df.author=="Robin_Hobb"]
Out[23]:
rating review_count isbn booktype author_url year genre_urls dir rating_count name author genres
667 4.10 2980 0006480098 book https://www.goodreads.com/author/show/25307.Ro... 1995 /genres/fantasy|/genres/fiction|/genres/fantas... dir07/45107.Assassin_s_Apprentice.html 87652 Assassin's Apprentice (Farseer Trilogy, #1) Robin_Hobb fantasy|fiction|fantasy|epic-fantasy|fantasy|h...
1232 4.18 1228 0006480101 book https://www.goodreads.com/author/show/25307.Ro... 1996 /genres/fantasy|/genres/fiction|/genres/fantas... dir13/68487.Royal_Assassin.html 59860 Royal Assassin (Farseer Trilogy, #2) Robin_Hobb fantasy|fiction|fantasy|epic-fantasy|fantasy|h...
1619 4.32 578 0553582461 book https://www.goodreads.com/author/show/25307.Ro... 2003 /genres/fantasy|/genres/fiction|/genres/fantas... dir17/45108.Fool_s_Fate.html 28379 Fool's Fate (Tawny Man, #3) Robin_Hobb fantasy|fiction|fantasy|epic-fantasy|science-f...
1647 4.07 769 000649885X book https://www.goodreads.com/author/show/25307.Ro... 1998 /genres/fantasy|/genres/fiction|/genres/fantas... dir17/45100.Ship_of_Magic.html 24477 Ship of Magic (Liveship Traders, #1) Robin_Hobb fantasy|fiction|fantasy|epic-fantasy|fantasy|d...
1760 4.16 454 0553575651 book https://www.goodreads.com/author/show/25307.Ro... 2000 /genres/fantasy|/genres/fiction|/genres/fantas... dir18/45102.Ship_of_Destiny.html 19916 Ship of Destiny (Liveship Traders, #3) Robin_Hobb fantasy|fiction|fantasy|epic-fantasy|fantasy|d...
2033 4.15 371 0006498868 book https://www.goodreads.com/author/show/25307.Ro... 1999 /genres/fantasy|/genres/fiction|/genres/fantas... dir21/45101.The_Mad_Ship.html 19829 The Mad Ship (Liveship Traders, #2) Robin_Hobb fantasy|fiction|fantasy|epic-fantasy|fantasy|d...
2148 4.23 585 0006486010 book https://www.goodreads.com/author/show/25307.Ro... 2001 /genres/fantasy|/genres/fiction|/genres/fantas... dir22/68488.Fool_s_Errand.html 31573 Fool's Errand (Tawny Man, #1) Robin_Hobb fantasy|fiction|fantasy|epic-fantasy|science-f...
2483 4.27 349 0553582453 book https://www.goodreads.com/author/show/25307.Ro... 2002 /genres/fantasy|/genres/fiction|/genres/fantas... dir25/45109.Golden_Fool.html 28463 Golden Fool (Tawny Man, #2) Robin_Hobb fantasy|fiction|fantasy|epic-fantasy|science-f...
In [24]:
df.review_count.hist(bins=np.arange(0, 40000, 400));
In [25]:
df.review_count.hist(bins=100)
plt.xscale("log");
In [26]:
sns.set_palette("husl")
df.review_count.hist(bins=100, log=True)
plt.xscale("log");
In [29]:
plt.scatter(df.rating_count, df.rating, lw=0, alpha=.08)
plt.xlabel("Number of ratings")
plt.ylabel("Rating")
Out[29]:
<matplotlib.text.Text at 0x10a6f49d0>
In [30]:
decade =  (df.year // 10) * 10
print type(decade)
decade
<class 'pandas.core.series.Series'>
Out[30]:
0     2000
1     2000
2     2000
3     1960
4     1810
5     1930
6     1940
7     1960
8     1940
9     1970
10    1990
11    2000
12    2000
13    1860
14    1590
...
5985    2000
5986    2010
5987    1940
5988    1970
5989    2010
5990    1980
5991    2000
5992    2000
5993    2010
5994    2000
5995    2000
5996    2000
5997    2010
5998    2000
5999    2000
Name: year, Length: 5993, dtype: int64
In [31]:
bydecade_df = df[['name', 'year']]
bydecade_df['decade'] = decade

bydecade_df.head()
Out[31]:
name year decade
0 The Hunger Games (The Hunger Games, #1) 2008 2000
1 Harry Potter and the Order of the Phoenix (Har... 2003 2000
2 Twilight (Twilight, #1) 2005 2000
3 To Kill a Mockingbird 1960 1960
4 Pride and Prejudice 1813 1810
In [32]:
dfdecade=df.groupby(decade)
print type(dfdecade)
dfdecade.groups
<class 'pandas.core.groupby.DataFrameGroupBy'>
Out[32]:
{-1500: [1398],
 -800: [47, 246],
 -560: [1397],
 -520: [674],
 -500: [746],
 -460: [1815],
 -450: [777],
 -440: [1428, 2527],
 -430: [629],
 -420: [2078, 3757],
 -400: [1233, 1882, 3133],
 -390: [4475],
 -380: [455],
 -370: [4402],
 -360: [5367],
 -350: [3274],
 -30: [596],
 0: [1330, 4717],
 10: [1752],
 100: [2329],
 120: [4843],
 130: [1860],
 150: [4534],
 170: [1169],
 200: [1622, 5404],
 210: [2564],
 390: [1393],
 630: [301],
 800: [327],
 900: [569],
 960: [4953],
 1000: [852, 2567],
 1010: [5439],
 1100: [1653, 5798],
 1140: [5831],
 1200: [4691],
 1210: [3311],
 1220: [4054],
 1300: [2863],
 1310: [363],
 1320: [132, 5354],
 1340: [913],
 1380: [1878, 4422],
 1390: [167, 3272, 5542],
 1480: [1613],
 1510: [1692],
 1520: [2266, 3894],
 1530: [384, 3753],
 1570: [2177, 4637],
 1580: [5705],
 1590: [14, 161, 495, 539, 774, 1144, 1204, 3954],
 1600: [82, 245, 248, 489, 531, 797, 2384, 2454, 2687, 3097, 5345, 5361],
 1610: [918, 4617],
 1620: [283, 5598],
 1630: [3200],
 1640: [4877],
 1660: [254],
 1670: [897],
 1680: [4792],
 1690: [3217],
 1710: [392],
 1720: [315, 1219, 4547],
 1740: [1514, 3788],
 1750: [258],
 1760: [983],
 1770: [910, 1288, 2178, 4894, 4993],
 1780: [370, 1215, 1268, 2537],
 1790: [693, 773, 2471, 2553, 3927, 4395, 5243, 5300, 5355],
 1800: [5173],
 1810: [4, 61, 328, 439, 637, 843, 2870, 3354, 3912, 4818],
 1820: [587, 857, 924, 2541, 3305],
 1830: [178,
  390,
  617,
  1078,
  1184,
  1648,
  1842,
  2198,
  2267,
  3055,
  3145,
  3777,
  4191,
  4317,
  4511,
  4690,
  5096,
  5250],
 1840: [34,
  42,
  51,
  156,
  247,
  324,
  441,
  945,
  954,
  1412,
  1423,
  1707,
  2114,
  2711,
  2752,
  2866,
  3276,
  3532,
  3533,
  3607,
  3744,
  3770,
  4934,
  5283,
  5382,
  5963],
 1850: [44,
  89,
  109,
  171,
  189,
  252,
  255,
  264,
  358,
  443,
  502,
  957,
  1245,
  1458,
  1556,
  1686,
  1813,
  1839,
  2723,
  2816,
  3043,
  3873,
  4223,
  4328,
  4445,
  5048],
 1860: [13,
  15,
  21,
  62,
  92,
  180,
  273,
  472,
  537,
  806,
  1079,
  1223,
  1304,
  1378,
  1516,
  1523,
  2734,
  3079,
  3152,
  3731,
  3769,
  4087,
  4094,
  4770,
  5014,
  5101,
  5736],
 1870: [48,
  102,
  292,
  355,
  513,
  808,
  858,
  934,
  1171,
  1338,
  1371,
  2106,
  2502,
  2668,
  2876,
  2893,
  2962,
  3023,
  3541,
  3869,
  4031,
  4181,
  4930,
  5041,
  5811],
 1880: [36,
  74,
  187,
  279,
  511,
  604,
  654,
  981,
  991,
  1075,
  1094,
  1104,
  1341,
  1506,
  1541,
  1544,
  1765,
  1799,
  1872,
  1887,
  2250,
  2427,
  2676,
  2766,
  3334,
  3338,
  3450,
  3466,
  3475,
  3563,
  3878,
  3923,
  3925,
  4851,
  4857,
  5215,
  5645,
  5961],
 1890: [20,
  29,
  64,
  150,
  152,
  164,
  266,
  305,
  485,
  541,
  573,
  613,
  694,
  907,
  931,
  1112,
  1724,
  1851,
  2210,
  2229,
  2238,
  2405,
  2634,
  2792,
  3104,
  3113,
  3796,
  4252,
  4282,
  4333,
  4714,
  4752,
  5008,
  5099,
  5208,
  5252,
  5549],
 1900: [23,
  133,
  139,
  141,
  149,
  177,
  203,
  210,
  342,
  348,
  375,
  409,
  429,
  545,
  691,
  821,
  933,
  946,
  1317,
  1381,
  1387,
  1456,
  1465,
  1665,
  1776,
  1837,
  1903,
  2080,
  2286,
  2525,
  2713,
  2793,
  2955,
  3064,
  3080,
  3149,
  3155,
  3187,
  3304,
  3350,
  3506,
  3525,
  3651,
  3761,
  3915,
  3963,
  4083,
  4242,
  4630,
  4634,
  4635,
  4815,
  4910,
  5126,
  5159,
  5225,
  5265,
  5505,
  5601,
  5634,
  5838],
 1910: [39,
  126,
  235,
  290,
  318,
  412,
  454,
  493,
  567,
  601,
  622,
  655,
  1012,
  1059,
  1279,
  1337,
  1612,
  1758,
  1770,
  1807,
  1810,
  1908,
  1991,
  2156,
  2200,
  2330,
  2332,
  2456,
  2466,
  2496,
  2595,
  2860,
  3177,
  3265,
  3344,
  3509,
  3546,
  3555,
  3679,
  3729,
  3897,
  3941,
  4163,
  4326,
  4625,
  4659,
  4965,
  5196,
  5481,
  5594,
  5690],
 1920: [58,
  81,
  100,
  134,
  155,
  170,
  175,
  190,
  213,
  225,
  234,
  303,
  353,
  397,
  398,
  399,
  419,
  453,
  669,
  775,
  790,
  807,
  818,
  890,
  1065,
  1073,
  1242,
  1373,
  1388,
  1519,
  1550,
  1621,
  1656,
  1703,
  1711,
  1749,
  1891,
  1930,
  2251,
  2276,
  2376,
  2407,
  2467,
  2526,
  2531,
  2558,
  2660,
  2788,
  2804,
  2974,
  3008,
  3022,
  3156,
  3175,
  3251,
  3403,
  3448,
  3490,
  3587,
  3590,
  3630,
  3685,
  3783,
  3881,
  3909,
  3952,
  3962,
  4136,
  4184,
  4505,
  4544,
  4581,
  4701,
  4773,
  4791,
  4802,
  4974,
  4980,
  5064,
  5190,
  5291,
  5334,
  5546,
  5547,
  5647,
  5713,
  5739,
  5781,
  5844,
  5915],
 1930: [5,
  27,
  31,
  71,
  130,
  143,
  241,
  304,
  308,
  431,
  437,
  518,
  530,
  599,
  639,
  681,
  683,
  741,
  749,
  750,
  755,
  776,
  799,
  849,
  871,
  993,
  1046,
  1063,
  1228,
  1239,
  1247,
  1367,
  1379,
  1441,
  1445,
  1479,
  1528,
  1533,
  1552,
  1633,
  1639,
  1671,
  1745,
  1804,
  1838,
  1885,
  2038,
  2045,
  2096,
  2124,
  2184,
  2191,
  2216,
  2224,
  2243,
  2342,
  2355,
  2539,
  2583,
  2633,
  2647,
  2659,
  2701,
  2717,
  2886,
  2891,
  2988,
  3063,
  3069,
  3139,
  3356,
  3441,
  3479,
  3537,
  3540,
  3703,
  3762,
  3817,
  3841,
  3967,
  4142,
  4161,
  4189,
  4216,
  4268,
  4275,
  4299,
  4342,
  4413,
  4476,
  4570,
  4613,
  4642,
  4702,
  4711,
  4713,
  4719,
  4749,
  4800,
  4801,
  4822,
  5033,
  5086,
  5111,
  5183,
  5200,
  5310,
  5385,
  5430,
  5863,
  5930,
  5948],
 1940: [6,
  8,
  63,
  75,
  116,
  211,
  219,
  240,
  365,
  369,
  393,
  407,
  428,
  450,
  452,
  462,
  468,
  474,
  477,
  498,
  556,
  804,
  831,
  848,
  968,
  982,
  1045,
  1047,
  1096,
  1224,
  1249,
  1265,
  1274,
  1283,
  1287,
  1307,
  1309,
  1311,
  1316,
  1464,
  1467,
  1493,
  1504,
  1599,
  1662,
  1721,
  1738,
  1747,
  1779,
  1791,
  1795,
  1823,
  1833,
  1848,
  1869,
  2012,
  2024,
  2029,
  2056,
  2134,
  2138,
  2187,
  2201,
  2218,
  2306,
  2404,
  2409,
  2420,
  2440,
  2488,
  2538,
  2562,
  2744,
  2791,
  2808,
  2887,
  2937,
  2942,
  2958,
  3007,
  3024,
  3329,
  3333,
  3469,
  3583,
  3584,
  3601,
  3646,
  3710,
  3728,
  3822,
  3880,
  3886,
  3907,
  3913,
  3986,
  4029,
  4051,
  4119,
  4310,
  4337,
  4442,
  4517,
  4553,
  4673,
  4708,
  4715,
  4756,
  4796,
  4797,
  4805,
  4853,
  4937,
  4963,
  4992,
  5065,
  5171,
  5456,
  5462,
  5599,
  5821,
  5925,
  5953,
  5959,
  5987],
 1950: [18,
  22,
  25,
  49,
  56,
  77,
  98,
  101,
  103,
  118,
  123,
  124,
  144,
  194,
  200,
  230,
  259,
  277,
  288,
  294,
  302,
  307,
  354,
  356,
  391,
  426,
  432,
  438,
  444,
  463,
  469,
  484,
  500,
  503,
  546,
  566,
  579,
  597,
  603,
  631,
  662,
  677,
  711,
  712,
  724,
  727,
  737,
  844,
  886,
  895,
  899,
  908,
  909,
  951,
  985,
  988,
  989,
  999,
  1014,
  1049,
  1098,
  1107,
  1128,
  1179,
  1209,
  1234,
  1272,
  1332,
  1453,
  1494,
  1498,
  1501,
  1521,
  1594,
  1698,
  1734,
  1737,
  1767,
  1915,
  1950,
  2005,
  2018,
  2041,
  2052,
  2063,
  2118,
  2268,
  2292,
  2308,
  2394,
  2414,
  2560,
  2570,
  2620,
  2629,
  2662,
  2683,
  2696,
  2733,
  2806,
  2895,
  2934,
  2967,
  2990,
  2997,
  3038,
  3099,
  3124,
  3182,
  3219,
  3337,
  3363,
  3377,
  3381,
  3396,
  3478,
  3499,
  3622,
  3672,
  3684,
  3719,
  3737,
  3855,
  3856,
  3864,
  3871,
  4008,
  4023,
  4035,
  4048,
  4059,
  4074,
  4078,
  4089,
  4149,
  4183,
  4222,
  4236,
  4283,
  4306,
  4344,
  4345,
  4378,
  4430,
  4449,
  4471,
  4497,
  4508,
  4529,
  4592,
  4602,
  4604,
  4610,
  4663,
  4688,
  4726,
  4734,
  4863,
  4946,
  4985,
  4994,
  5002,
  5020,
  5049,
  5090,
  5155,
  5205,
  5288,
  5333,
  5468,
  5485,
  5496,
  5517,
  5586,
  5639,
  5679,
  5701,
  5726,
  5740,
  5757,
  5784,
  5805,
  5833,
  5909,
  5926],
 1960: [3,
  7,
  28,
  33,
  35,
  41,
  50,
  52,
  53,
  55,
  66,
  69,
  73,
  104,
  105,
  111,
  112,
  122,
  129,
  166,
  208,
  232,
  236,
  253,
  349,
  377,
  446,
  521,
  548,
  551,
  578,
  580,
  608,
  609,
  614,
  626,
  664,
  673,
  680,
  685,
  695,
  696,
  721,
  743,
  838,
  839,
  845,
  875,
  879,
  930,
  955,
  966,
  969,
  996,
  998,
  1003,
  1008,
  1010,
  1055,
  1069,
  1102,
  1122,
  1126,
  1133,
  1153,
  1185,
  1301,
  1404,
  1407,
  1411,
  1413,
  1437,
  1442,
  1538,
  1540,
  1593,
  1604,
  1638,
  1695,
  1746,
  1766,
  1819,
  1847,
  1916,
  1969,
  1986,
  2002,
  2013,
  2022,
  2060,
  2061,
  2081,
  2117,
  2141,
  2176,
  2179,
  2225,
  2227,
  2239,
  2240,
  2269,
  2310,
  2359,
  2381,
  2382,
  2402,
  2406,
  2422,
  2458,
  2470,
  2485,
  2499,
  2507,
  2574,
  2585,
  2592,
  2614,
  2749,
  2828,
  2897,
  2912,
  2936,
  3000,
  3006,
  3034,
  3076,
  3164,
  3185,
  3310,
  3379,
  3420,
  3463,
  3494,
  3516,
  3545,
  3578,
  3602,
  3624,
  3644,
  3650,
  3670,
  3701,
  3718,
  3724,
  3807,
  3825,
  3836,
  3867,
  3899,
  3973,
  4006,
  4044,
  4050,
  4109,
  4123,
  4129,
  4235,
  4240,
  4273,
  4428,
  4546,
  4586,
  4603,
  4631,
  4636,
  4647,
  4666,
  4722,
  4803,
  4821,
  4855,
  4859,
  4869,
  4908,
  4921,
  5135,
  5140,
  5172,
  5175,
  5201,
  5202,
  5216,
  5279,
  5311,
  5326,
  5365,
  5393,
  5402,
  5408,
  5457,
  5508,
  5537,
  5600,
  5615,
  5620,
  5631,
  5672,
  5682,
  5800,
  5806,
  5822,
  5830,
  5905,
  5922,
  5941],
 1970: [9,
  17,
  30,
  57,
  59,
  93,
  99,
  119,
  137,
  148,
  165,
  168,
  181,
  183,
  202,
  207,
  221,
  224,
  229,
  261,
  269,
  270,
  271,
  313,
  322,
  338,
  362,
  389,
  420,
  449,
  524,
  528,
  536,
  549,
  581,
  583,
  598,
  600,
  610,
  636,
  645,
  651,
  675,
  682,
  687,
  704,
  707,
  715,
  769,
  789,
  803,
  868,
  893,
  894,
  920,
  956,
  965,
  977,
  980,
  1028,
  1034,
  1040,
  1042,
  1053,
  1054,
  1082,
  1089,
  1113,
  1123,
  1162,
  1167,
  1173,
  1175,
  1178,
  1195,
  1196,
  1197,
  1202,
  1205,
  1208,
  1210,
  1230,
  1241,
  1251,
  1298,
  1326,
  1351,
  1362,
  1376,
  1409,
  1452,
  1463,
  1473,
  1485,
  1507,
  1530,
  1563,
  1570,
  1573,
  1590,
  1601,
  1618,
  1627,
  1678,
  1680,
  1684,
  1716,
  1821,
  1826,
  1868,
  1870,
  1876,
  1923,
  1932,
  1945,
  1958,
  1963,
  2028,
  2030,
  2039,
  2048,
  2091,
  2107,
  2123,
  2133,
  2209,
  2212,
  2221,
  2223,
  2312,
  2346,
  2398,
  2401,
  2415,
  2419,
  2430,
  2432,
  2435,
  2490,
  2491,
  2494,
  2497,
  2533,
  2575,
  2631,
  2643,
  2653,
  2663,
  2689,
  2692,
  2693,
  2762,
  2850,
  2853,
  2926,
  2929,
  2951,
  3019,
  3047,
  3048,
  3059,
  3073,
  3077,
  3147,
  3166,
  3290,
  3298,
  3306,
  3319,
  3361,
  3404,
  3421,
  3433,
  3457,
  3465,
  3470,
  3485,
  3530,
  3531,
  3557,
  3566,
  3591,
  3592,
  3597,
  3638,
  3659,
  3720,
  3725,
  3756,
  3797,
  3826,
  3860,
  3863,
  3892,
  3896,
  3976,
  3977,
  4010,
  4028,
  4030,
  4032,
  4037,
  4111,
  4116,
  4120,
  4130,
  4148,
  4165,
  4172,
  4199,
  4207,
  4218,
  4226,
  4234,
  4261,
  4264,
  4266,
  4270,
  4271,
  4289,
  4338,
  4363,
  4406,
  4415,
  4444,
  4467,
  4520,
  4525,
  4598,
  4656,
  4667,
  4684,
  4700,
  4721,
  4729,
  4732,
  4774,
  4785,
  4793,
  4823,
  4841,
  4865,
  4871,
  4893,
  4903,
  4952,
  4970,
  4986,
  5047,
  5059,
  5060,
  5097,
  5125,
  5141,
  5156,
  5161,
  5189,
  5210,
  5211,
  5212,
  5226,
  5234,
  5239,
  5248,
  5267,
  5271,
  5276,
  5373,
  5389,
  5398,
  5507,
  5523,
  5529,
  5541,
  5562,
  5579,
  5595,
  5637,
  5684,
  5688,
  5696,
  5702,
  5707,
  5714,
  5716,
  5742,
  5775,
  5788,
  5847,
  5864,
  5874,
  5881,
  5886,
  5908,
  5929,
  5980,
  5983,
  5988],
 1980: [19,
  24,
  54,
  67,
  72,
  84,
  91,
  106,
  110,
  121,
  128,
  145,
  151,
  153,
  158,
  159,
  169,
  186,
  196,
  197,
  216,
  231,
  243,
  250,
  251,
  262,
  267,
  272,
  280,
  298,
  300,
  312,
  314,
  323,
  325,
  333,
  334,
  339,
  341,
  346,
  352,
  404,
  411,
  414,
  418,
  461,
  481,
  520,
  533,
  542,
  552,
  558,
  560,
  564,
  582,
  591,
  594,
  606,
  615,
  652,
  656,
  658,
  660,
  665,
  672,
  697,
  700,
  703,
  708,
  744,
  754,
  759,
  779,
  783,
  785,
  795,
  836,
  853,
  866,
  867,
  881,
  882,
  889,
  892,
  901,
  914,
  916,
  947,
  949,
  964,
  997,
  1050,
  1052,
  1067,
  1084,
  1093,
  1100,
  1105,
  1127,
  1129,
  1135,
  1140,
  1143,
  1166,
  1201,
  1237,
  1256,
  1258,
  1292,
  1305,
  1334,
  1339,
  1342,
  1348,
  1364,
  1382,
  1383,
  1389,
  1402,
  1405,
  1417,
  1422,
  1451,
  1454,
  1475,
  1482,
  1491,
  1495,
  1497,
  1509,
  1536,
  1557,
  1558,
  1597,
  1600,
  1611,
  1614,
  1616,
  1620,
  1641,
  1649,
  1674,
  1677,
  1685,
  1688,
  1700,
  1704,
  1710,
  1712,
  1713,
  1743,
  1756,
  1761,
  1774,
  1811,
  1830,
  1849,
  1866,
  1873,
  1874,
  1892,
  1898,
  1917,
  1937,
  1967,
  1996,
  1999,
  2006,
  2015,
  2025,
  2054,
  2071,
  2144,
  2166,
  2172,
  2206,
  2233,
  2270,
  2274,
  2281,
  2290,
  2295,
  2301,
  2307,
  2313,
  2315,
  2316,
  2320,
  2326,
  2374,
  2392,
  2421,
  2484,
  2492,
  2506,
  2511,
  2518,
  2528,
  2542,
  2572,
  2576,
  2623,
  2655,
  2679,
  2680,
  2682,
  2722,
  2725,
  2729,
  2743,
  2764,
  2784,
  2802,
  2824,
  2849,
  2881,
  2892,
  2905,
  2916,
  2948,
  2960,
  2966,
  2968,
  3026,
  3031,
  3066,
  3072,
  3078,
  3096,
  3100,
  3109,
  3134,
  3142,
  3154,
  3180,
  3196,
  3204,
  3215,
  3221,
  3278,
  3296,
  3320,
  3343,
  3349,
  3359,
  3370,
  3380,
  3385,
  3388,
  3424,
  3462,
  3500,
  3501,
  3502,
  3544,
  3547,
  3560,
  3579,
  3585,
  3599,
  3604,
  3613,
  3627,
  3635,
  3636,
  3648,
  3660,
  3675,
  3681,
  3698,
  3705,
  3715,
  3722,
  3750,
  3758,
  3778,
  3802,
  3829,
  3830,
  3882,
  3884,
  3887,
  3903,
  3917,
  3939,
  3943,
  3956,
  3960,
  3985,
  4002,
  4011,
  4015,
  4049,
  4055,
  4058,
  4063,
  4080,
  4088,
  4099,
  4127,
  4154,
  4169,
  4177,
  4198,
  4200,
  4206,
  4219,
  4255,
  4276,
  4277,
  4294,
  4296,
  4343,
  4365,
  4368,
  4375,
  4376,
  4380,
  4427,
  4441,
  4453,
  4455,
  4456,
  4461,
  4466,
  4468,
  4495,
  4512,
  4518,
  4536,
  4554,
  4558,
  4559,
  4575,
  4639,
  4644,
  4664,
  4674,
  4716,
  4736,
  4753,
  4765,
  4772,
  4775,
  4781,
  4794,
  4799,
  4808,
  4813,
  4830,
  4846,
  4847,
  4866,
  4881,
  4888,
  4911,
  4914,
  4920,
  4933,
  4935,
  4948,
  4966,
  4967,
  5000,
  5003,
  5006,
  5022,
  5031,
  5032,
  5039,
  5054,
  5056,
  5058,
  5067,
  5069,
  5076,
  5078,
  5084,
  5085,
  5087,
  5110,
  5121,
  5124,
  5149,
  5162,
  5163,
  5168,
  5178,
  5197,
  5217,
  5221,
  5228,
  5238,
  5258,
  5262,
  5277,
  5280,
  5314,
  5322,
  5337,
  5350,
  5356,
  5363,
  5369,
  5376,
  5391,
  5399,
  5401,
  5466,
  5489,
  5566,
  5567,
  5568,
  5575,
  5582,
  5592,
  5604,
  5611,
  5628,
  5640,
  5661,
  5662,
  5677,
  5678,
  5700,
  5725,
  5776,
  5785,
  5813,
  5841,
  5848,
  5868,
  5871,
  5878,
  5889,
  5912,
  5938,
  5949,
  5950,
  5958,
  5964,
  5970,
  5977,
  5990],
 1990: [10,
  65,
  70,
  76,
  78,
  80,
  86,
  88,
  90,
  95,
  96,
  107,
  108,
  131,
  135,
  136,
  154,
  172,
  174,
  176,
  191,
  199,
  215,
  218,
  220,
  227,
  228,
  233,
  237,
  263,
  268,
  274,
  275,
  287,
  291,
  293,
  295,
  306,
  316,
  321,
  332,
  340,
  350,
  351,
  359,
  364,
  367,
  372,
  373,
  374,
  378,
  381,
  382,
  388,
  394,
  395,
  396,
  410,
  424,
  425,
  445,
  447,
  456,
  457,
  466,
  476,
  480,
  486,
  490,
  504,
  514,
  515,
  517,
  538,
  550,
  561,
  575,
  585,
  602,
  605,
  607,
  612,
  618,
  625,
  627,
  628,
  635,
  641,
  642,
  649,
  667,
  671,
  676,
  679,
  684,
  688,
  692,
  701,
  702,
  705,
  714,
  716,
  718,
  719,
  739,
  742,
  753,
  756,
  761,
  771,
  780,
  787,
  788,
  796,
  800,
  810,
  813,
  826,
  828,
  829,
  832,
  833,
  835,
  863,
  876,
  878,
  883,
  885,
  891,
  903,
  904,
  915,
  917,
  922,
  926,
  950,
  972,
  975,
  976,
  984,
  994,
  995,
  1011,
  1013,
  1021,
  1030,
  1039,
  1048,
  1066,
  1071,
  1074,
  1077,
  1087,
  1091,
  1097,
  1101,
  1111,
  1121,
  1130,
  1131,
  1136,
  1148,
  1156,
  1161,
  1163,
  1168,
  1180,
  1183,
  1189,
  1193,
  1194,
  1200,
  1206,
  1212,
  1220,
  1222,
  1226,
  1231,
  1232,
  1235,
  1243,
  1260,
  1261,
  1264,
  1266,
  1267,
  1289,
  1291,
  1295,
  1297,
  1306,
  1313,
  1321,
  1327,
  1352,
  1360,
  1361,
  1366,
  1390,
  1392,
  1410,
  1416,
  1421,
  1427,
  1432,
  1438,
  1440,
  1448,
  1476,
  1481,
  1484,
  1486,
  1490,
  1499,
  1500,
  1510,
  1511,
  1513,
  1526,
  1532,
  1534,
  1543,
  1546,
  1549,
  1551,
  1553,
  1555,
  1566,
  1567,
  1574,
  1577,
  1578,
  1580,
  1581,
  1582,
  1584,
  1591,
  1596,
  1623,
  1628,
  1636,
  1642,
  1647,
  1650,
  1651,
  1659,
  1663,
  1664,
  1679,
  1683,
  1691,
  1696,
  1699,
  1705,
  1715,
  1719,
  1722,
  1729,
  1730,
  1731,
  1732,
  1751,
  1754,
  1775,
  1790,
  1792,
  1801,
  1825,
  1835,
  1843,
  1845,
  1856,
  1864,
  1880,
  1893,
  1895,
  1896,
  1897,
  1900,
  1909,
  1929,
  1935,
  1949,
  1953,
  1956,
  1962,
  1964,
  1971,
  1973,
  1981,
  1987,
  1993,
  1998,
  2009,
  2010,
  2011,
  2016,
  2033,
  2036,
  2042,
  2043,
  2044,
  2046,
  2051,
  2057,
  2065,
  2068,
  2074,
  2077,
  2097,
  2099,
  2104,
  2109,
  2111,
  2120,
  2125,
  2126,
  2127,
  2128,
  2129,
  2137,
  2139,
  2143,
  2152,
  2173,
  2180,
  2195,
  2202,
  2204,
  2217,
  2220,
  2228,
  2241,
  2242,
  2246,
  2253,
  2260,
  2282,
  2291,
  2300,
  2318,
  2328,
  2335,
  2336,
  2337,
  2353,
  2354,
  2361,
  2367,
  2397,
  2399,
  2418,
  2426,
  2434,
  2444,
  2448,
  2465,
  2472,
  2477,
  2479,
  2514,
  2516,
  2517,
  2519,
  2530,
  2535,
  2536,
  2545,
  2549,
  2557,
  2559,
  2566,
  2568,
  2577,
  2588,
  2589,
  2591,
  2596,
  2621,
  2625,
  2637,
  2641,
  2645,
  2654,
  2658,
  2667,
  2677,
  2678,
  2700,
  2708,
  2718,
  2732,
  2745,
  2759,
  2760,
  2771,
  2779,
  2799,
  2803,
  2810,
  2811,
  2817,
  2823,
  2829,
  2832,
  2834,
  2837,
  2871,
  2898,
  2904,
  2911,
  2932,
  2950,
  2954,
  2971,
  2987,
  3011,
  3013,
  3015,
  3017,
  3020,
  3041,
  3053,
  3083,
  3085,
  3089,
  3090,
  3110,
  3114,
  3141,
  3144,
  3146,
  3158,
  3159,
  3171,
  3173,
  3192,
  3207,
  3212,
  3213,
  3214,
  3223,
  3242,
  3253,
  3277,
  3282,
  3297,
  3316,
  3317,
  3318,
  3321,
  3323,
  3328,
  3330,
  3335,
  3345,
  3362,
  3372,
  3373,
  3375,
  3387,
  3409,
  3417,
  3419,
  3422,
  3425,
  3428,
  3438,
  3443,
  3456,
  3467,
  3468,
  3471,
  3482,
  3489,
  3491,
  3514,
  3515,
  3519,
  3522,
  3526,
  3528,
  3586,
  3593,
  3594,
  3596,
  3600,
  3617,
  3619,
  3623,
  3625,
  3626,
  3633,
  3634,
  3637,
  3639,
  3642,
  3647,
  3661,
  3666,
  3673,
  3676,
  3683,
  3689,
  3704,
  3707,
  3708,
  3711,
  3714,
  3727,
  3739,
  3767,
  3774,
  3779,
  3791,
  3809,
  3813,
  3816,
  3821,
  3824,
  3828,
  3838,
  3853,
  3857,
  3858,
  3862,
  3870,
  3876,
  3890,
  3905,
  3911,
  3938,
  3961,
  3964,
  3971,
  3972,
  3974,
  3979,
  3984,
  3998,
  3999,
  4012,
  4013,
  4021,
  4056,
  4060,
  4067,
  4090,
  4101,
  4106,
  4108,
  4110,
  4118,
  4128,
  4135,
  4137,
  4145,
  4151,
  4153,
  4155,
  4190,
  4194,
  4204,
  4213,
  4221,
  4238,
  4239,
  4243,
  4244,
  4249,
  4259,
  4262,
  4265,
  4267,
  4274,
  4281,
  4302,
  4309,
  4311,
  4319,
  4320,
  4346,
  4347,
  4358,
  4360,
  4366,
  4367,
  4370,
  4371,
  4374,
  4388,
  4398,
  4400,
  4408,
  4416,
  4419,
  4429,
  4438,
  4446,
  4454,
  4457,
  4486,
  4496,
  4498,
  4499,
  4506,
  4523,
  4526,
  4528,
  4537,
  4552,
  4565,
  4574,
  4582,
  4583,
  4584,
  4593,
  4605,
  4608,
  4628,
  4646,
  4665,
  4679,
  4689,
  4694,
  4695,
  4698,
  4703,
  4718,
  4727,
  4733,
  4747,
  4748,
  4754,
  4760,
  4764,
  4779,
  4795,
  4798,
  4804,
  4809,
  4819,
  4820,
  4825,
  4834,
  4835,
  4849,
  4864,
  4868,
  4883,
  4887,
  4892,
  4915,
  4918,
  4927,
  4932,
  4936,
  4944,
  4956,
  4957,
  4961,
  4964,
  4978,
  4982,
  4988,
  4999,
  5010,
  5011,
  5012,
  5017,
  5028,
  5030,
  5038,
  5044,
  5046,
  5092,
  5094,
  5102,
  5107,
  5114,
  5174,
  5179,
  5187,
  5188,
  5209,
  5223,
  5231,
  5235,
  5237,
  5245,
  5246,
  5247,
  5249,
  5257,
  5261,
  5263,
  5266,
  5273,
  5274,
  5275,
  5284,
  5296,
  5301,
  5302,
  5304,
  5306,
  5312,
  5324,
  5327,
  5329,
  5335,
  5336,
  5338,
  5340,
  5344,
  5353,
  5358,
  5360,
  5368,
  5372,
  5384,
  5392,
  5394,
  5405,
  5409,
  5440,
  5441,
  5463,
  5464,
  5465,
  5469,
  5484,
  5487,
  5490,
  5512,
  5514,
  5527,
  5540,
  5569,
  5570,
  5576,
  5583,
  5603,
  5617,
  5624,
  5638,
  5641,
  5642,
  5646,
  5648,
  5654,
  5667,
  5668,
  5681,
  5691,
  5699,
  5708,
  5721,
  5738,
  5741,
  5750,
  5773,
  5786,
  5797,
  5803,
  5808,
  5812,
  5814,
  5832,
  5840,
  5853,
  5855,
  5865,
  5869,
  5893,
  5904,
  5906,
  5910,
  5932,
  5940,
  5954,
  5966,
  5967,
  5968],
 2000: [0,
  1,
  2,
  11,
  12,
  16,
  32,
  37,
  38,
  40,
  45,
  46,
  60,
  68,
  79,
  83,
  85,
  87,
  94,
  97,
  113,
  114,
  115,
  117,
  120,
  125,
  127,
  138,
  140,
  142,
  146,
  147,
  157,
  160,
  162,
  173,
  179,
  184,
  185,
  188,
  192,
  193,
  195,
  198,
  201,
  204,
  205,
  206,
  212,
  214,
  217,
  222,
  223,
  226,
  238,
  239,
  244,
  249,
  257,
  276,
  278,
  281,
  285,
  286,
  289,
  296,
  297,
  309,
  310,
  311,
  317,
  319,
  326,
  330,
  335,
  336,
  337,
  343,
  345,
  347,
  357,
  360,
  366,
  368,
  376,
  379,
  380,
  383,
  387,
  401,
  402,
  403,
  405,
  413,
  415,
  416,
  417,
  422,
  427,
  434,
  435,
  436,
  440,
  442,
  451,
  458,
  459,
  460,
  464,
  465,
  467,
  470,
  471,
  473,
  475,
  478,
  479,
  483,
  487,
  488,
  491,
  492,
  494,
  501,
  505,
  506,
  507,
  510,
  516,
  519,
  522,
  523,
  526,
  535,
  540,
  543,
  544,
  553,
  555,
  557,
  559,
  562,
  563,
  565,
  568,
  570,
  572,
  574,
  576,
  584,
  586,
  590,
  593,
  595,
  611,
  616,
  619,
  621,
  624,
  630,
  632,
  633,
  638,
  640,
  643,
  646,
  647,
  650,
  653,
  657,
  663,
  666,
  668,
  670,
  678,
  690,
  698,
  699,
  706,
  710,
  713,
  717,
  722,
  723,
  725,
  726,
  728,
  730,
  732,
  734,
  738,
  740,
  745,
  751,
  752,
  757,
  762,
  763,
  764,
  770,
  772,
  778,
  782,
  784,
  786,
  792,
  794,
  798,
  802,
  805,
  809,
  811,
  815,
  817,
  820,
  822,
  823,
  825,
  837,
  840,
  846,
  847,
  855,
  856,
  859,
  860,
  861,
  862,
  864,
  865,
  872,
  873,
  887,
  896,
  898,
  900,
  902,
  905,
  912,
  919,
  921,
  928,
  929,
  932,
  935,
  937,
  940,
  941,
  943,
  948,
  952,
  958,
  959,
  960,
  961,
  962,
  963,
  971,
  973,
  978,
  987,
  990,
  992,
  1000,
  1001,
  1004,
  1005,
  1009,
  1017,
  1018,
  1019,
  1020,
  1022,
  1023,
  1024,
  1025,
  1027,
  1031,
  1032,
  1033,
  1035,
  1037,
  1041,
  1044,
  1051,
  1056,
  1057,
  1058,
  1060,
  1061,
  1064,
  1068,
  1076,
  1080,
  1083,
  1085,
  1088,
  1090,
  1095,
  1099,
  1114,
  1117,
  1124,
  1132,
  1137,
  1139,
  1141,
  1142,
  1145,
  1146,
  1147,
  1149,
  1150,
  1154,
  1157,
  1160,
  1172,
  1176,
  1177,
  1182,
  1187,
  1191,
  1199,
  1203,
  1207,
  1211,
  1213,
  1216,
  1217,
  1221,
  1225,
  1238,
  1240,
  1246,
  1250,
  1257,
  1262,
  1271,
  1273,
  1275,
  1276,
  1280,
  1281,
  1284,
  1285,
  1286,
  1293,
  1294,
  1299,
  1303,
  1312,
  1315,
  1318,
  1322,
  1324,
  1328,
  1331,
  1335,
  1336,
  1340,
  1344,
  1345,
  1349,
  1353,
  1356,
  1359,
  1363,
  1365,
  1368,
  1369,
  1370,
  1372,
  1374,
  1380,
  1384,
  1385,
  1386,
  1391,
  1395,
  1399,
  1401,
  1406,
  1408,
  1414,
  1415,
  1420,
  1424,
  1425,
  1426,
  1431,
  1434,
  1435,
  1436,
  1439,
  1443,
  1444,
  1446,
  1449,
  1450,
  1459,
  1460,
  1461,
  1462,
  1468,
  1469,
  1470,
  1472,
  1474,
  1478,
  1480,
  1483,
  1489,
  1502,
  1503,
  1512,
  1518,
  1520,
  1527,
  1529,
  1531,
  1537,
  1539,
  1542,
  1545,
  1548,
  1560,
  1564,
  1565,
  1568,
  1569,
  1571,
  1579,
  1583,
  1585,
  1586,
  1587,
  1589,
  1592,
  1598,
  1602,
  1605,
  1606,
  1608,
  1615,
  1619,
  1624,
  1629,
  1631,
  1635,
  1637,
  1640,
  1645,
  1646,
  1652,
  1654,
  1655,
  1657,
  1660,
  1661,
  1666,
  1667,
  1669,
  1670,
  1673,
  1675,
  1682,
  1687,
  1690,
  1693,
  1694,
  1701,
  1709,
  1717,
  1723,
  1727,
  1728,
  1736,
  1740,
  1744,
  1748,
  1753,
  1755,
  1757,
  1759,
  1760,
  1763,
  1764,
  1768,
  1769,
  1771,
  1773,
  1778,
  1780,
  1781,
  1782,
  1783,
  1787,
  1788,
  1789,
  1797,
  1800,
  1805,
  1808,
  1809,
  1814,
  1816,
  1817,
  1818,
  1820,
  1827,
  1829,
  1832,
  1834,
  1850,
  1853,
  1859,
  1861,
  1862,
  1863,
  1865,
  1867,
  1871,
  1883,
  1886,
  1888,
  1890,
  1894,
  1899,
  1901,
  1904,
  1905,
  1907,
  1910,
  1912,
  1913,
  1918,
  1919,
  1920,
  1922,
  1925,
  1931,
  1933,
  1936,
  1938,
  1943,
  1948,
  1952,
  1954,
  1955,
  1961,
  1975,
  1976,
  1977,
  1980,
  1982,
  1983,
  1984,
  1988,
  1990,
  1992,
  1995,
  1997,
  2000,
  2004,
  2007,
  2008,
  2014,
  2017,
  2019,
  2020,
  2026,
  2027,
  2031,
  2035,
  2037,
  2040,
  2047,
  2049,
  2055,
  2058,
  2062,
  2066,
  2072,
  2082,
  2083,
  2088,
  2089,
  2090,
  2092,
  2093,
  2094,
  2098,
  2100,
  2101,
  2102,
  2103,
  2105,
  2112,
  2115,
  2116,
  2119,
  2121,
  2122,
  2130,
  2131,
  2135,
  2136,
  2142,
  2146,
  2148,
  2149,
  2150,
  2151,
  2153,
  2158,
  2162,
  2164,
  2165,
  2167,
  2182,
  2183,
  2186,
  2189,
  2193,
  2197,
  2199,
  2205,
  2213,
  2214,
  2215,
  2219,
  2222,
  2226,
  2232,
  2234,
  2237,
  2244,
  2245,
  2247,
  2248,
  2252,
  2254,
  2255,
  2258,
  2262,
  2263,
  2264,
  2265,
  2272,
  2273,
  2278,
  2280,
  2283,
  2285,
  2287,
  2288,
  2293,
  2296,
  2299,
  2302,
  2303,
  2305,
  2311,
  2314,
  2319,
  2321,
  2322,
  2324,
  2325,
  2327,
  2340,
  2343,
  2344,
  2348,
  2350,
  2351,
  2356,
  2357,
  2358,
  2362,
  2363,
  2364,
  2365,
  2366,
  2368,
  2369,
  2371,
  2372,
  2373,
  2379,
  2380,
  2383,
  2385,
  2386,
  2389,
  2391,
  2395,
  2396,
  2403,
  2411,
  2412,
  2416,
  2417,
  2423,
  2424,
  2425,
  2428,
  2431,
  2436,
  2445,
  2447,
  2449,
  2450,
  2453,
  2457,
  2461,
  2462,
  2463,
  2473,
  2474,
  2475,
  2478,
  2482,
  2483,
  2487,
  2498,
  2501,
  2504,
  2505,
  2508,
  2509,
  2512,
  2520,
  2522,
  2523,
  2529,
  2543,
  2544,
  2546,
  2551,
  2552,
  2555,
  2565,
  2569,
  2571,
  2578,
  2579,
  2580,
  2581,
  2586,
  2590,
  2593,
  2594,
  2597,
  2601,
  2603,
  2604,
  2612,
  2613,
  2615,
  2622,
  2626,
  2632,
  2635,
  2636,
  2638,
  2639,
  2640,
  2642,
  2644,
  2648,
  2650,
  2652,
  2661,
  2666,
  2671,
  2674,
  2675,
  2686,
  2690,
  2694,
  2695,
  2697,
  2698,
  2702,
  2709,
  2710,
  2712,
  2716,
  2719,
  2720,
  2727,
  2728,
  2730,
  2731,
  2735,
  2736,
  2738,
  2740,
  2742,
  2750,
  2751,
  2753,
  2754,
  2755,
  2761,
  2763,
  2765,
  2767,
  2768,
  2770,
  2772,
  2773,
  2774,
  2777,
  2778,
  2780,
  2781,
  2782,
  2783,
  2785,
  2786,
  2787,
  2789,
  2790,
  2795,
  2796,
  2797,
  2798,
  2800,
  2801,
  2805,
  2807,
  2809,
  2813,
  2814,
  2819,
  2820,
  2822,
  2827,
  2833,
  2835,
  2840,
  2841,
  2842,
  2845,
  2846,
  2847,
  2851,
  2854,
  2855,
  2856,
  2857,
  2858,
  2859,
  2875,
  2878,
  2880,
  2884,
  2885,
  2888,
  2890,
  2899,
  2906,
  2907,
  2910,
  2915,
  2917,
  2923,
  2924,
  2925,
  2931,
  2938,
  2939,
  2940,
  2943,
  2944,
  2949,
  2957,
  2959,
  2961,
  2964,
  2965,
  2969,
  2970,
  2972,
  2973,
  2975,
  2976,
  2978,
  2979,
  2981,
  2982,
  2983,
  2984,
  2986,
  2992,
  2993,
  2994,
  2995,
  2999,
  3003,
  3004,
  3005,
  3010,
  3014,
  3016,
  3021,
  3025,
  3027,
  3029,
  3032,
  3033,
  3035,
  3039,
  3042,
  3044,
  3045,
  3046,
  3049,
  3050,
  3051,
  3056,
  3057,
  3060,
  3061,
  3067,
  3068,
  3071,
  3075,
  3081,
  3082,
  3087,
  3088,
  3091,
  3092,
  3094,
  3103,
  3108,
  3112,
  3115,
  3116,
  3117,
  3118,
  3120,
  3121,
  3123,
  3126,
  3129,
  3130,
  3131,
  3135,
  3136,
  3143,
  3148,
  3150,
  3151,
  3153,
  3165,
  3167,
  3168,
  3169,
  3170,
  3172,
  3176,
  3178,
  3181,
  3183,
  3184,
  3186,
  3189,
  3193,
  3195,
  3197,
  3198,
  3199,
  3202,
  3203,
  3206,
  3210,
  3211,
  3216,
  3218,
  3220,
  3222,
  3224,
  3230,
  3231,
  3232,
  3233,
  3234,
  3236,
  3237,
  3240,
  3243,
  3246,
  3248,
  3249,
  3250,
  3255,
  3262,
  3263,
  3266,
  3267,
  3269,
  3270,
  3271,
  3279,
  3285,
  3286,
  3287,
  3288,
  3291,
  3295,
  3300,
  3301,
  3303,
  3307,
  3308,
  3309,
  3313,
  3322,
  3324,
  3327,
  3336,
  3339,
  3341,
  3342,
  3346,
  3351,
  3352,
  3353,
  3355,
  3360,
  3364,
  3365,
  3367,
  3368,
  3369,
  3371,
  3374,
  3376,
  3378,
  3382,
  3383,
  3386,
  3391,
  3392,
  3394,
  3395,
  3398,
  3399,
  3400,
  3401,
  3402,
  3405,
  3410,
  3415,
  3418,
  3423,
  3426,
  3429,
  3430,
  3431,
  3432,
  3434,
  3435,
  3442,
  3444,
  3449,
  3451,
  3452,
  3453,
  3459,
  3464,
  3472,
  3473,
  3474,
  3477,
  3480,
  3483,
  3488,
  3492,
  3495,
  3496,
  3505,
  3507,
  3508,
  3510,
  3511,
  3512,
  3513,
  3517,
  3518,
  3523,
  3524,
  3527,
  3529,
  3534,
  3535,
  3536,
  3538,
  3539,
  3542,
  3543,
  3548,
  3550,
  3552,
  3556,
  3558,
  3559,
  3561,
  3564,
  3570,
  3572,
  3574,
  3577,
  3581,
  3582,
  3588,
  3595,
  3603,
  3605,
  3608,
  3609,
  3611,
  3612,
  3615,
  3616,
  3618,
  3620,
  3628,
  3629,
  3631,
  3632,
  3640,
  3641,
  3645,
  3649,
  3653,
  3654,
  3655,
  3658,
  3665,
  3667,
  3668,
  3680,
  3686,
  3696,
  3700,
  3702,
  3706,
  3709,
  3713,
  3716,
  3717,
  3721,
  3723,
  3726,
  3730,
  3735,
  3736,
  3742,
  3743,
  3745,
  3748,
  3749,
  3754,
  3755,
  3763,
  3764,
  3765,
  3766,
  3771,
  3772,
  3780,
  3781,
  3782,
  3787,
  3789,
  3794,
  3801,
  3808,
  3810,
  3815,
  3818,
  3823,
  3827,
  3834,
  3835,
  3837,
  3839,
  3845,
  3846,
  3848,
  3851,
  3854,
  3859,
  3865,
  3866,
  3872,
  3875,
  3879,
  3883,
  3888,
  3889,
  3893,
  3900,
  3901,
  3902,
  3904,
  3908,
  3910,
  3914,
  3918,
  3919,
  3920,
  3926,
  3929,
  3932,
  3933,
  3934,
  3935,
  3937,
  3940,
  3942,
  3945,
  3946,
  3948,
  3949,
  3950,
  3951,
  3955,
  3957,
  3958,
  3959,
  3966,
  3968,
  3969,
  3970,
  3975,
  3978,
  3983,
  3987,
  3988,
  3989,
  3990,
  3992,
  3993,
  4000,
  4001,
  4003,
  4004,
  4005,
  4014,
  4018,
  4019,
  4020,
  4024,
  4025,
  4027,
  4033,
  4036,
  4038,
  4039,
  4040,
  4042,
  4043,
  4046,
  4061,
  4069,
  4070,
  4073,
  4075,
  4079,
  4084,
  4085,
  4091,
  4093,
  4095,
  4096,
  4097,
  4098,
  4100,
  4102,
  4107,
  4112,
  4113,
  4114,
  4115,
  4117,
  4121,
  4125,
  4126,
  4134,
  4138,
  4139,
  4140,
  4144,
  4146,
  4150,
  4152,
  4156,
  4157,
  4158,
  4159,
  4160,
  4162,
  4166,
  4167,
  4174,
  4175,
  4179,
  4180,
  4185,
  4186,
  4187,
  4192,
  4197,
  4201,
  4205,
  4211,
  4217,
  4220,
  4224,
  4228,
  4229,
  4230,
  4231,
  4233,
  4237,
  4245,
  4246,
  4247,
  4248,
  4251,
  4253,
  4254,
  4258,
  4260,
  4263,
  4269,
  4278,
  4280,
  4284,
  4285,
  4286,
  4291,
  4293,
  4303,
  4304,
  4307,
  4308,
  4312,
  4313,
  4315,
  4318,
  4321,
  4322,
  4325,
  4327,
  4329,
  4330,
  4331,
  4332,
  4334,
  4336,
  4340,
  4341,
  4348,
  4349,
  4350,
  4351,
  4353,
  4354,
  4355,
  4356,
  4359,
  4361,
  4362,
  4364,
  4369,
  4372,
  4373,
  4379,
  4391,
  4394,
  4397,
  4399,
  4407,
  4409,
  4411,
  4412,
  4414,
  4417,
  4421,
  4423,
  4431,
  4432,
  4443,
  4448,
  4459,
  4462,
  4463,
  4464,
  4465,
  4477,
  4479,
  4481,
  4484,
  4485,
  4489,
  4491,
  4493,
  4494,
  4500,
  4507,
  4509,
  4510,
  4513,
  4514,
  4516,
  4519,
  4521,
  4522,
  4527,
  4530,
  4531,
  4538,
  4539,
  4540,
  4541,
  4542,
  4543,
  4555,
  4556,
  4560,
  4561,
  4564,
  4566,
  4567,
  4571,
  4573,
  4579,
  4580,
  4585,
  4587,
  4590,
  4594,
  4595,
  4596,
  4606,
  4607,
  4609,
  4616,
  4618,
  4619,
  4620,
  4622,
  4623,
  4624,
  4626,
  4627,
  4629,
  4632,
  4633,
  4640,
  4648,
  4649,
  4651,
  4654,
  4657,
  4658,
  4661,
  4669,
  4670,
  4671,
  4672,
  4675,
  4676,
  4677,
  4680,
  4681,
  4686,
  4687,
  4692,
  4693,
  4697,
  4699,
  4704,
  4706,
  4720,
  4723,
  4724,
  4725,
  4730,
  4735,
  4738,
  4740,
  4741,
  4742,
  4743,
  4744,
  4745,
  4746,
  4751,
  4755,
  4758,
  4761,
  4766,
  4768,
  4776,
  4777,
  4778,
  4782,
  4783,
  4784,
  4786,
  4787,
  4806,
  4807,
  4812,
  4817,
  4831,
  4832,
  4833,
  4837,
  4840,
  4842,
  4844,
  4845,
  4848,
  4850,
  4852,
  4854,
  4858,
  4867,
  4870,
  4872,
  4878,
  4879,
  4880,
  4882,
  4884,
  4885,
  4886,
  4889,
  4895,
  4896,
  4897,
  4898,
  4899,
  4901,
  4907,
  4909,
  4912,
  4913,
  4916,
  4917,
  4919,
  4922,
  4923,
  4924,
  4925,
  4926,
  4938,
  4945,
  4954,
  4955,
  4958,
  4959,
  4960,
  4962,
  4971,
  4973,
  4979,
  4981,
  4983,
  4987,
  4989,
  4990,
  4991,
  4995,
  4996,
  4997,
  5001,
  5004,
  5005,
  5007,
  5009,
  5013,
  5018,
  5019,
  5021,
  5029,
  5034,
  5040,
  5042,
  5043,
  5045,
  5052,
  5053,
  5055,
  5057,
  5061,
  5066,
  5068,
  5072,
  5073,
  5074,
  5075,
  5077,
  5082,
  5083,
  5088,
  5091,
  5095,
  5098,
  5100,
  5103,
  5104,
  5105,
  5106,
  5108,
  5112,
  5113,
  5115,
  5118,
  5120,
  5122,
  5130,
  5131,
  5132,
  5136,
  5138,
  5139,
  5142,
  5143,
  5144,
  5146,
  5147,
  5150,
  5152,
  5160,
  5164,
  5165,
  5170,
  5180,
  5182,
  5191,
  5194,
  5195,
  5198,
  5199,
  5203,
  5204,
  5206,
  5220,
  5222,
  5224,
  5230,
  5232,
  5236,
  5240,
  5241,
  5242,
  5244,
  5251,
  5256,
  5264,
  5268,
  5269,
  5270,
  5272,
  5281,
  5285,
  5286,
  5292,
  5293,
  5294,
  5297,
  5303,
  5305,
  5307,
  5313,
  5318,
  5321,
  5323,
  5325,
  5328,
  5330,
  5331,
  5332,
  5339,
  5341,
  5342,
  5343,
  5346,
  5351,
  5352,
  5370,
  5375,
  5377,
  5378,
  5383,
  5386,
  5387,
  5390,
  5395,
  5396,
  5400,
  5406,
  5407,
  5410,
  5412,
  5431,
  5436,
  5437,
  5438,
  5444,
  5445,
  5447,
  5448,
  5455,
  5459,
  5460,
  5461,
  5467,
  5482,
  5486,
  5488,
  5491,
  5492,
  5494,
  5497,
  5499,
  5506,
  5509,
  5510,
  5511,
  5516,
  5518,
  5520,
  5524,
  5531,
  5534,
  5535,
  5536,
  5538,
  5543,
  5550,
  5553,
  5557,
  5571,
  5574,
  5578,
  5581,
  5589,
  5593,
  5596,
  5597,
  5602,
  5605,
  5609,
  5612,
  5621,
  5622,
  5623,
  5627,
  5632,
  5643,
  5644,
  5649,
  5650,
  5651,
  5653,
  5655,
  5656,
  5669,
  5670,
  5671,
  5673,
  5674,
  5675,
  5676,
  5687,
  5695,
  5697,
  5698,
  5703,
  5704,
  5706,
  5710,
  5711,
  5712,
  5722,
  5723,
  5724,
  5731,
  5732,
  5733,
  5734,
  5735,
  5737,
  5745,
  5748,
  5751,
  5752,
  5761,
  5765,
  5767,
  5768,
  5769,
  5770,
  5771,
  5772,
  5774,
  5777,
  5779,
  5780,
  5783,
  5796,
  5799,
  5801,
  5802,
  5804,
  5807,
  5809,
  5810,
  5818,
  5828,
  5829,
  5834,
  5835,
  5836,
  5837,
  5842,
  5843,
  5846,
  5849,
  5850,
  5852,
  5857,
  5859,
  5860,
  5861,
  5862,
  5866,
  5867,
  5870,
  5885,
  5887,
  5888,
  5890,
  5891,
  5892,
  5896,
  5901,
  5907,
  5911,
  5913,
  5916,
  5919,
  5921,
  5923,
  5924,
  5927,
  5928,
  5931,
  5935,
  5937,
  5939,
  5945,
  5951,
  5952,
  5955,
  5956,
  5960,
  5962,
  5969,
  5971,
  5978,
  5979,
  5981,
  5982,
  5984,
  5985,
  5991,
  5992,
  5994,
  5995,
  5996,
  5998,
  5999],
 2010: [26,
  43,
  163,
  182,
  209,
  242,
  256,
  260,
  265,
  282,
  284,
  299,
  320,
  329,
  331,
  344,
  361,
  371,
  385,
  386,
  400,
  406,
  408,
  421,
  423,
  430,
  433,
  448,
  482,
  496,
  497,
  499,
  508,
  509,
  512,
  525,
  527,
  529,
  532,
  534,
  547,
  554,
  571,
  577,
  588,
  589,
  592,
  620,
  623,
  634,
  644,
  648,
  659,
  661,
  686,
  689,
  709,
  720,
  729,
  731,
  733,
  735,
  736,
  747,
  748,
  758,
  760,
  765,
  766,
  767,
  768,
  781,
  791,
  793,
  801,
  812,
  814,
  816,
  819,
  824,
  827,
  830,
  834,
  841,
  842,
  850,
  851,
  854,
  869,
  870,
  874,
  877,
  880,
  884,
  888,
  906,
  911,
  923,
  925,
  927,
  936,
  938,
  939,
  942,
  944,
  953,
  967,
  970,
  974,
  979,
  986,
  1002,
  1006,
  1007,
  1015,
  1016,
  1026,
  1029,
  1036,
  1038,
  1043,
  1062,
  1070,
  1072,
  1081,
  1086,
  1092,
  1103,
  1106,
  1108,
  1109,
  1110,
  1115,
  1116,
  1118,
  1119,
  1120,
  1125,
  1134,
  1138,
  1151,
  1152,
  1155,
  1158,
  1159,
  1164,
  1165,
  1170,
  1174,
  1181,
  1186,
  1188,
  1190,
  1192,
  1198,
  1214,
  1218,
  1227,
  1229,
  1236,
  1244,
  1248,
  1252,
  1253,
  1254,
  1255,
  1259,
  1263,
  1269,
  1270,
  1277,
  1278,
  1282,
  1290,
  1296,
  1300,
  1302,
  1308,
  1310,
  1314,
  1319,
  1320,
  1323,
  1325,
  1329,
  1333,
  1343,
  1346,
  1347,
  1350,
  1354,
  1355,
  1357,
  1358,
  1375,
  1377,
  1394,
  1396,
  1400,
  1403,
  1418,
  1419,
  1429,
  1430,
  1433,
  1447,
  1455,
  1457,
  1466,
  1471,
  1477,
  1487,
  1488,
  1492,
  1496,
  1505,
  1508,
  1515,
  1517,
  1522,
  1524,
  1525,
  1535,
  1547,
  1554,
  1559,
  1561,
  1562,
  1572,
  1575,
  1576,
  1588,
  1595,
  1603,
  1607,
  1609,
  1610,
  1617,
  1625,
  1626,
  1630,
  1632,
  1634,
  1643,
  1644,
  1658,
  1668,
  1672,
  1676,
  1681,
  1689,
  1697,
  1702,
  1706,
  1708,
  1714,
  1718,
  1720,
  1725,
  1726,
  1733,
  1735,
  1739,
  1741,
  1742,
  1750,
  1762,
  1772,
  1777,
  1784,
  1785,
  1786,
  1793,
  1794,
  1796,
  1798,
  1802,
  1803,
  1806,
  1812,
  1822,
  1824,
  1828,
  1831,
  1836,
  1840,
  1841,
  1844,
  1846,
  1852,
  1854,
  1855,
  1857,
  1858,
  1875,
  1877,
  1879,
  1881,
  1884,
  1889,
  1902,
  1906,
  1911,
  1914,
  1921,
  1924,
  1926,
  1927,
  1928,
  1934,
  1939,
  1940,
  1941,
  1942,
  1944,
  1946,
  1947,
  1951,
  1957,
  1959,
  1960,
  1965,
  1966,
  1968,
  1970,
  1972,
  1974,
  1978,
  1979,
  1985,
  1989,
  1994,
  2001,
  2003,
  2021,
  2023,
  2032,
  2034,
  2050,
  2053,
  2059,
  2064,
  2067,
  2069,
  2070,
  2073,
  2075,
  2076,
  2079,
  2084,
  2085,
  2086,
  2087,
  2095,
  2108,
  2110,
  2113,
  2132,
  2140,
  2145,
  2147,
  2154,
  2155,
  2157,
  2159,
  2160,
  2161,
  2163,
  2168,
  2169,
  2170,
  2171,
  2174,
  2175,
  2181,
  2185,
  2188,
  2190,
  2192,
  2194,
  2196,
  2203,
  2207,
  2208,
  2211,
  2230,
  2231,
  2235,
  2236,
  2249,
  2256,
  2257,
  2259,
  2261,
  2271,
  2275,
  2277,
  2279,
  2284,
  2289,
  2294,
  2297,
  2298,
  2304,
  2309,
  2317,
  2323,
  2331,
  2333,
  2334,
  2338,
  2339,
  2341,
  2345,
  2347,
  2349,
  2352,
  2360,
  2370,
  2375,
  2377,
  2378,
  2387,
  2388,
  2390,
  2393,
  2400,
  2408,
  2410,
  2413,
  2429,
  2433,
  2437,
  2438,
  2439,
  2441,
  2443,
  2446,
  2451,
  2452,
  2455,
  2459,
  2460,
  2464,
  2468,
  2469,
  2476,
  2480,
  2481,
  2486,
  2489,
  2493,
  2495,
  2500,
  2503,
  2510,
  2513,
  2515,
  2521,
  2524,
  2532,
  2534,
  2540,
  2547,
  2548,
  2550,
  2554,
  2556,
  2561,
  2563,
  2573,
  2582,
  2584,
  2587,
  2598,
  2599,
  2600,
  2602,
  2605,
  2606,
  2607,
  2608,
  2609,
  2610,
  2611,
  2616,
  2617,
  2618,
  2619,
  2624,
  2627,
  2628,
  2630,
  2646,
  2649,
  2651,
  2656,
  2657,
  2664,
  2665,
  2669,
  2670,
  2672,
  2673,
  2681,
  2684,
  2685,
  2688,
  2691,
  2699,
  2703,
  2704,
  2705,
  2706,
  2707,
  2714,
  2715,
  2721,
  2724,
  2726,
  2737,
  2739,
  2741,
  2746,
  2747,
  2748,
  2756,
  2757,
  2758,
  2769,
  2775,
  2776,
  2794,
  2812,
  2815,
  2818,
  2821,
  2825,
  2826,
  2830,
  2831,
  2836,
  2838,
  2839,
  2843,
  2844,
  2848,
  2852,
  2861,
  2862,
  2864,
  2865,
  2867,
  2868,
  2872,
  2873,
  2874,
  2877,
  2879,
  2882,
  2883,
  2889,
  2894,
  2896,
  2900,
  2901,
  2902,
  2903,
  2908,
  2909,
  2913,
  2914,
  2918,
  2919,
  2920,
  2921,
  2922,
  2927,
  2928,
  2930,
  2933,
  2935,
  2941,
  2945,
  2946,
  2947,
  2952,
  2953,
  2956,
  2963,
  2977,
  2980,
  2985,
  2989,
  2991,
  2996,
  2998,
  3001,
  3002,
  3009,
  3012,
  3018,
  3028,
  3030,
  3036,
  3037,
  3040,
  3052,
  3054,
  3058,
  3062,
  3065,
  3070,
  3074,
  3084,
  3086,
  3093,
  3095,
  3098,
  3101,
  3102,
  3105,
  3106,
  3107,
  3111,
  3119,
  3122,
  3125,
  3127,
  3128,
  3132,
  3137,
  3138,
  3140,
  3157,
  3160,
  3161,
  3162,
  3163,
  3174,
  3179,
  3188,
  3190,
  3191,
  3194,
  3201,
  3205,
  3208,
  3209,
  3225,
  3226,
  3227,
  3228,
  3229,
  3235,
  3238,
  3239,
  3241,
  3244,
  3245,
  3247,
  3252,
  3254,
  3256,
  3257,
  3258,
  3259,
  3260,
  3261,
  3264,
  3268,
  3273,
  3275,
  3280,
  3281,
  3283,
  3284,
  3289,
  3292,
  3293,
  3294,
  3299,
  3302,
  3312,
  3314,
  3315,
  3325,
  3326,
  3331,
  3332,
  3340,
  3347,
  3348,
  3357,
  3358,
  3366,
  3384,
  3389,
  3390,
  3393,
  3397,
  3406,
  3407,
  3408,
  3411,
  3412,
  3413,
  3414,
  3416,
  3427,
  3436,
  3437,
  3439,
  3440,
  3445,
  3446,
  3447,
  3454,
  3455,
  3458,
  3460,
  3461,
  3476,
  3481,
  3484,
  3486,
  3487,
  3493,
  3497,
  3498,
  3503,
  3504,
  3520,
  3521,
  3549,
  3551,
  3553,
  3554,
  3562,
  3565,
  3567,
  3568,
  3569,
  3571,
  3573,
  3575,
  3576,
  3580,
  3589,
  3598,
  3606,
  3610,
  3614,
  3621,
  3652,
  3656,
  3657,
  3662,
  3663,
  3664,
  3669,
  3671,
  3674,
  3677,
  3678,
  3682,
  3687,
  3688,
  3690,
  3691,
  3692,
  3693,
  3694,
  3695,
  3697,
  3699,
  3712,
  3732,
  3733,
  3734,
  3738,
  3740,
  3741,
  3746,
  3747,
  3751,
  3752,
  3759,
  3760,
  3768,
  3773,
  3775,
  3776,
  3784,
  3785,
  3786,
  3790,
  3792,
  3793,
  3795,
  3798,
  3799,
  3800,
  3803,
  3804,
  3805,
  3806,
  3811,
  3812,
  3814,
  3819,
  3820,
  3831,
  3832,
  3833,
  3840,
  3842,
  3843,
  3844,
  3847,
  3849,
  3850,
  3852,
  3861,
  3868,
  3874,
  3877,
  3885,
  3891,
  3895,
  3898,
  3906,
  3916,
  3921,
  3922,
  3924,
  3928,
  3930,
  3931,
  3936,
  3944,
  3947,
  3953,
  3965,
  3980,
  3981,
  3982,
  3991,
  3994,
  3995,
  3996,
  3997,
  4007,
  4009,
  4016,
  4017,
  4022,
  4026,
  4034,
  4041,
  4045,
  4047,
  4052,
  4053,
  4057,
  4062,
  4064,
  4065,
  4066,
  4068,
  4071,
  4072,
  4076,
  4077,
  4081,
  4082,
  4086,
  4092,
  4103,
  4104,
  4105,
  4122,
  4124,
  4131,
  4132,
  4133,
  4141,
  4143,
  4147,
  4164,
  4168,
  4170,
  4171,
  4173,
  4176,
  4178,
  4182,
  4188,
  4193,
  4195,
  4196,
  4202,
  4203,
  4208,
  4209,
  4210,
  4212,
  4214,
  4215,
  4225,
  4227,
  4232,
  4241,
  4250,
  4256,
  4257,
  4272,
  4279,
  4287,
  4288,
  4290,
  4292,
  4295,
  4297,
  4298,
  4300,
  4301,
  4305,
  4314,
  4316,
  4323,
  4324,
  4335,
  4339,
  4352,
  4357,
  4377,
  4381,
  4382,
  4383,
  4384,
  4385,
  4386,
  4387,
  4389,
  4390,
  4392,
  4393,
  4396,
  4401,
  4403,
  4404,
  4405,
  4410,
  4418,
  4420,
  4424,
  4425,
  4426,
  4433,
  4434,
  4435,
  4436,
  4437,
  4439,
  4440,
  4447,
  4450,
  4451,
  4452,
  4458,
  4460,
  4469,
  4470,
  4472,
  4473,
  4474,
  4478,
  4480,
  4482,
  4483,
  4487,
  4488,
  4490,
  4492,
  4501,
  4502,
  4503,
  4504,
  4515,
  4524,
  4532,
  4533,
  4535,
  4545,
  4548,
  4549,
  4550,
  4551,
  4557,
  4562,
  4563,
  4568,
  4569,
  4572,
  4576,
  4577,
  4578,
  4588,
  4589,
  4591,
  4597,
  4599,
  4600,
  4601,
  4611,
  4612,
  4614,
  4615,
  4621,
  4638,
  4641,
  4643,
  4645,
  4650,
  4652,
  4653,
  4655,
  4660,
  4662,
  4668,
  4678,
  4682,
  4683,
  4685,
  4696,
  4705,
  4707,
  4709,
  4710,
  4712,
  4728,
  4731,
  4737,
  4739,
  4750,
  4757,
  4759,
  4762,
  4763,
  4767,
  4769,
  4771,
  4780,
  4788,
  4789,
  4790,
  4810,
  4811,
  4814,
  4816,
  4824,
  4826,
  4827,
  4828,
  4829,
  4836,
  4838,
  4839,
  4856,
  4860,
  4861,
  4862,
  4873,
  4874,
  4875,
  4876,
  4890,
  4891,
  4900,
  4902,
  4904,
  4905,
  4906,
  4928,
  4929,
  4931,
  4939,
  4940,
  4941,
  4942,
  4943,
  4947,
  4949,
  4950,
  4951,
  4968,
  4969,
  4972,
  4975,
  4976,
  4977,
  4984,
  4998,
  5015,
  5016,
  5023,
  5024,
  5025,
  5026,
  5027,
  5035,
  5036,
  5037,
  5050,
  5051,
  5062,
  5063,
  5070,
  5071,
  5079,
  5080,
  5081,
  5089,
  5093,
  5109,
  5116,
  5117,
  5119,
  5123,
  5127,
  5128,
  5129,
  5133,
  5134,
  5137,
  5145,
  5148,
  5151,
  5153,
  5154,
  5157,
  5158,
  5166,
  5167,
  5169,
  5176,
  5177,
  5181,
  5184,
  5185,
  5186,
  5192,
  5193,
  5207,
  5213,
  5214,
  5218,
  5219,
  5227,
  5229,
  5233,
  5253,
  5254,
  5255,
  5259,
  5260,
  5278,
  5287,
  5289,
  5290,
  5295,
  5298,
  5299,
  5308,
  5309,
  5315,
  5316,
  5317,
  5319,
  5320,
  5347,
  5348,
  5349,
  5357,
  5359,
  5362,
  5364,
  5366,
  5371,
  5374,
  5379,
  5380,
  5381,
  5388,
  5397,
  5403,
  5411,
  5413,
  5414,
  5415,
  5416,
  5417,
  5418,
  5419,
  5420,
  5421,
  5422,
  5423,
  5424,
  5425,
  5426,
  5427,
  5428,
  5429,
  5432,
  5433,
  5434,
  5435,
  5442,
  5443,
  5446,
  5449,
  5450,
  5451,
  5452,
  5453,
  5454,
  5458,
  5470,
  5471,
  5472,
  5473,
  5474,
  5475,
  5476,
  5477,
  5478,
  5479,
  5480,
  5483,
  5493,
  5495,
  5498,
  5500,
  5501,
  5502,
  5503,
  5504,
  5513,
  5515,
  5519,
  5521,
  5522,
  5525,
  5526,
  5528,
  5530,
  5532,
  5533,
  5539,
  5544,
  5545,
  5548,
  5551,
  5552,
  5554,
  5555,
  5556,
  5558,
  5559,
  5560,
  5561,
  5563,
  5564,
  5565,
  5573,
  5577,
  5580,
  5584,
  5585,
  5587,
  5588,
  5590,
  5591,
  5606,
  5607,
  5608,
  5610,
  5613,
  5614,
  5616,
  5618,
  5619,
  5625,
  5626,
  5629,
  5630,
  5633,
  5635,
  5636,
  5652,
  5657,
  5659,
  5660,
  5663,
  5664,
  5665,
  5666,
  5680,
  5685,
  5686,
  5689,
  5692,
  5693,
  5694,
  5709,
  5715,
  5717,
  5718,
  5719,
  5720,
  5727,
  5728,
  5729,
  5730,
  5743,
  5744,
  5746,
  5747,
  5749,
  5753,
  5754,
  5755,
  5756,
  5758,
  5759,
  5760,
  5762,
  5763,
  5764,
  5766,
  5778,
  5782,
  5787,
  5789,
  5790,
  5791,
  5792,
  5793,
  5794,
  5795,
  5815,
  5816,
  5817,
  5819,
  5820,
  5823,
  5824,
  5825,
  5826,
  5827,
  5839,
  5845,
  5851,
  5854,
  5856,
  5858,
  5872,
  5873,
  5875,
  5876,
  5877,
  5879,
  5880,
  5882,
  5883,
  5884,
  5894,
  5895,
  5897,
  5898,
  5899,
  5900,
  5902,
  5903,
  5914,
  5917,
  5918,
  5920,
  5933,
  5934,
  5936,
  5942,
  5943,
  5944,
  5946,
  5947,
  5957,
  5965,
  5972,
  5973,
  5974,
  5975,
  5976,
  5986,
  5989,
  5993,
  5997]}
In [33]:
decade_ratings = df.groupby(decade).rating
decade_mean=decade_ratings.mean()
decade_mean.name = 'Decade Mean'
print decade_mean
year
-1500    3.600000
-800     3.845000
-560     4.030000
-520     3.920000
-500     4.060000
-460     3.960000
-450     3.520000
-440     3.870000
-430     3.640000
-420     3.830000
-400     4.086667
-390     4.110000
-380     3.850000
-370     3.990000
-360     4.070000
...
1870    4.014400
1880    3.956053
1890    3.935946
1900    4.005246
1910    3.962549
1920    4.008222
1930    4.059375
1940    4.061360
1950    4.047135
1960    4.075707
1970    4.044161
1980    4.031509
1990    4.021173
2000    4.003405
2010    4.128055
Name: Decade Mean, Length: 90, dtype: float64
In [34]:
decade_std=decade_ratings.std()
In [35]:
plt.plot(decade_mean.index, decade_mean.values, 'o-',
        color='r', lw=3, label='Decade Average')
plt.scatter(df.year, df.rating, alpha=.04, lw=0)
plt.fill_between(decade_mean.index, (decade_mean + decade_std).values,
                 (decade_mean - decade_std).values, color='r', alpha=.2)
plt.xlabel("Year")
plt.ylabel("Score")
plt.legend(frameon=False)
plt.xlim([1940, 2010]);
In [36]:
df.genres
Out[36]:
0     young-adult|science-fiction|dystopia|fantasy|s...
1     fantasy|young-adult|fiction|fantasy|magic|chil...
2     young-adult|fantasy|romance|paranormal|vampire...
3     classics|fiction|historical-fiction|academic|s...
4     classics|fiction|romance|historical-fiction|li...
5     classics|historical-fiction|fiction|romance|li...
6     classics|young-adult|childrens|christian|adven...
7     childrens|young-adult|childrens|picture-books|...
8     classics|fiction|science-fiction|dystopia|lite...
9     science-fiction|humor|fantasy|classics|humor|c...
10    fiction|historical-fiction|romance|cultural|ja...
11    mystery|thriller|suspense|historical-fiction|a...
12    historical-fiction|young-adult|fiction|book-cl...
13    classics|childrens|young-adult|literature|adve...
14    classics|plays|fiction|romance|academic|school...
...
5985    fiction|young-adult|book-club|young-adult|youn...
5986    young-adult|fantasy|paranormal|shapeshifters|w...
5987    economics|non-fiction|politics|business|philos...
5988    science-fiction|fantasy|fiction|classics|scien...
5989    european-literature|spanish-literature|drama|f...
5990    non-fiction|economics|history|biography|politi...
5991    novels|fiction|religion|literature|philosophy|...
5992    christian-fiction|christian|young-adult|fictio...
5993    mystery|mystery|crime|thriller|suspense|thrill...
5994    poetry|religion|christian|religion|theology|re...
5995    history|non-fiction|biography|adventure|book-c...
5996    young-adult|realistic-fiction|romance|contempo...
5997    contemporary|romance|young-adult|sociology|abu...
5998    religion|islam|religion|self-help|spirituality...
5999    fiction|fantasy|magic|science-fiction-fantasy|...
Name: genres, Length: 5993, dtype: object
In [43]:
genres = set()
for m in df.genres:
    genres.update(g for g in m.split('|'))
genres = sorted(genres)

for genre in genres:
    df["genre:"+genre] = [genre in g.split('|') for g in df.genres]
         
df.head()
Out[43]:
rating review_count isbn booktype author_url year genre_urls dir rating_count name author genres genre: genre:14th-century genre:15th-century genre:16th-century genre:17th-century genre:18th-century genre:19th-century genre:20th-century genre:abuse genre:academia genre:academic genre:action genre:activism genre:adolescence genre:adoption genre:adult genre:adult-fiction genre:adventure genre:africa genre:african-american genre:african-american-literature genre:african-literature genre:aliens genre:alternate-history genre:american genre:american-civil-war genre:american-fiction genre:american-history genre:american-novels genre:americana genre:anarchism genre:ancient genre:angels genre:animal-fiction genre:animals genre:anime genre:anthologies genre:anthropology ... genre:time-travel-romance genre:tragedy genre:trans genre:transgender genre:travel genre:travelogue genre:true-crime genre:true-story genre:turkish genre:turkish-literature genre:ukraine genre:unicorns genre:united-states genre:urban-fantasy genre:urban-planning genre:urbanism genre:us-presidents genre:utopia genre:vampires genre:vegan genre:video-games genre:walking genre:war genre:weird-fiction genre:werewolves genre:western genre:western-romance genre:wicca genre:wilderness genre:wildlife genre:witches genre:wizards genre:wolves genre:womens genre:womens-fiction genre:womens-studies genre:world-history genre:world-war-ii genre:writing genre:x-men genre:young-adult genre:young-adult-contemporary genre:young-adult-fantasy genre:young-adult-historical-fiction genre:young-adult-paranormal genre:young-adult-romance genre:young-adult-science-fiction genre:young-readers genre:zen genre:zombies
0 4.40 136455 0439023483 book https://www.goodreads.com/author/show/153394.S... 2008 /genres/young-adult|/genres/science-fiction|/g... dir01/2767052-the-hunger-games.html 2958974 The Hunger Games (The Hunger Games, #1) Suzanne_Collins young-adult|science-fiction|dystopia|fantasy|s... False False False False False False False False False False False True False False False False False True False False False False False False False False False False False False False False False False False False False False ... False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False True False False False False False False False False False
1 4.41 16648 0439358078 book https://www.goodreads.com/author/show/1077326.... 2003 /genres/fantasy|/genres/young-adult|/genres/fi... dir01/2.Harry_Potter_and_the_Order_of_the_Phoe... 1284478 Harry Potter and the Order of the Phoenix (Har... J_K_Rowling fantasy|young-adult|fiction|fantasy|magic|chil... False False False False False False False False False False False False False False False False False True False False False False False False False False False False False False False False False False False False False False ... False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False True False False False False False False False False False
2 3.56 85746 0316015849 book https://www.goodreads.com/author/show/941441.S... 2005 /genres/young-adult|/genres/fantasy|/genres/ro... dir01/41865.Twilight.html 2579564 Twilight (Twilight, #1) Stephenie_Meyer young-adult|fantasy|romance|paranormal|vampire... False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False ... False False False False False False False False False False False False False True False False False False True False False False False False False False False False False False False False False False False False False False False False True False False False False False False False False False
3 4.23 47906 0061120081 book https://www.goodreads.com/author/show/1825.Har... 1960 /genres/classics|/genres/fiction|/genres/histo... dir01/2657.To_Kill_a_Mockingbird.html 2078123 To Kill a Mockingbird Harper_Lee classics|fiction|historical-fiction|academic|s... False False False False False False False False False False True False False False False False False False False False False False False False False False False False False False False False False False False False False False ... False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False True False False False False False False False False False
4 4.23 34772 0679783261 book https://www.goodreads.com/author/show/1265.Jan... 1813 /genres/classics|/genres/fiction|/genres/roman... dir01/1885.Pride_and_Prejudice.html 1388992 Pride and Prejudice Jane_Austen classics|fiction|romance|historical-fiction|li... False False False False False False False False False False True False False False False True False False False False False False False False False False False False False False False False False False False False False False ... False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False False

5 rows × 550 columns

In [51]:
genreslist = ['genre:'+g for g in genres]
dfg=df[genreslist].sum()
dfg.sort(ascending=False)
dfg.ix[0:20].plot(kind="bar")
Out[51]:
<matplotlib.axes._subplots.AxesSubplot at 0x10b669c10>
In [60]:
genres_wanted=dfg.index[dfg.values> 550]
genres_wanted
Out[60]:
Index([u'genre:fiction', u'genre:fantasy', u'genre:romance', u'genre:young-adult', u'genre:literature', u'genre:classics', u'genre:novels', u'genre:contemporary', u'genre:adult', u'genre:paranormal', u'genre:adventure', u'genre:historical-fiction', u'genre:mystery', u'genre:science-fiction', u'genre:book-club', u'genre:cultural', u'genre:supernatural', u'genre:european-literature', u'genre:magic', u'genre:adult-fiction', u'genre:science-fiction-fantasy', u'genre:childrens', u'genre:urban-fantasy', u'genre:teen', u'genre:paranormal-romance', u'genre:thriller', u'genre:non-fiction', u'genre:humor', u'genre:womens-fiction', u'genre:chick-lit'], dtype='object')
In [64]:
fig, axes = plt.subplots(nrows=10, ncols=3, figsize=(12, 40), 
                         tight_layout=True)
#print axes.ravel()
bins = np.arange(1950, 2013, 3)
for ax, genre in zip(axes.ravel(), genres_wanted):
    #print genre, df[df[genre] == True].year.values
    ax.hist(df[df[genre] == True].year.values, 
            bins=bins, histtype='stepfilled', normed=True, color='r', alpha=.2, ec='none')
    ax.hist(df.year, bins=bins, histtype='stepfilled', ec='None', normed=True, zorder=0, color='#cccccc')
    
    ax.annotate(genre.split(':')[-1], xy=(1955, 3e-2), fontsize=12)
    ax.xaxis.set_ticks(np.arange(1950, 2013, 30))
    ax.set_yticks([])
    ax.set_xlabel('Year')
In [68]:
dfrecent=df[df.year > 1900]
g = sns.FacetGrid(dfrecent, col="genre:romance")
g.map(plt.hist, "year", bins=30);
In [69]:
dfrecent=df[df.year > 1900]
g = sns.FacetGrid(dfrecent, col="genre:romance", row='genre:humor')
g.map(plt.hist, "year", bins=30);
In [ ]: