|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": 1, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [], |
| 8 | + "source": [ |
| 9 | + "import pandas as pd" |
| 10 | + ] |
| 11 | + }, |
| 12 | + { |
| 13 | + "cell_type": "code", |
| 14 | + "execution_count": 3, |
| 15 | + "metadata": {}, |
| 16 | + "outputs": [], |
| 17 | + "source": [ |
| 18 | + "books = pd.read_csv(\"./data/books_2018.csv\")" |
| 19 | + ] |
| 20 | + }, |
| 21 | + { |
| 22 | + "cell_type": "code", |
| 23 | + "execution_count": 5, |
| 24 | + "metadata": {}, |
| 25 | + "outputs": [ |
| 26 | + { |
| 27 | + "data": { |
| 28 | + "text/plain": [ |
| 29 | + "436" |
| 30 | + ] |
| 31 | + }, |
| 32 | + "execution_count": 5, |
| 33 | + "metadata": {}, |
| 34 | + "output_type": "execute_result" |
| 35 | + } |
| 36 | + ], |
| 37 | + "source": [ |
| 38 | + "len(books)" |
| 39 | + ] |
| 40 | + }, |
| 41 | + { |
| 42 | + "cell_type": "code", |
| 43 | + "execution_count": 10, |
| 44 | + "metadata": {}, |
| 45 | + "outputs": [], |
| 46 | + "source": [ |
| 47 | + "df2 = pd.DataFrame({'Title':books.Title.unique()})\n" |
| 48 | + ] |
| 49 | + }, |
| 50 | + { |
| 51 | + "cell_type": "code", |
| 52 | + "execution_count": 11, |
| 53 | + "metadata": {}, |
| 54 | + "outputs": [ |
| 55 | + { |
| 56 | + "data": { |
| 57 | + "text/plain": [ |
| 58 | + "399" |
| 59 | + ] |
| 60 | + }, |
| 61 | + "execution_count": 11, |
| 62 | + "metadata": {}, |
| 63 | + "output_type": "execute_result" |
| 64 | + } |
| 65 | + ], |
| 66 | + "source": [ |
| 67 | + "len(df2)" |
| 68 | + ] |
| 69 | + }, |
| 70 | + { |
| 71 | + "cell_type": "code", |
| 72 | + "execution_count": 15, |
| 73 | + "metadata": {}, |
| 74 | + "outputs": [ |
| 75 | + { |
| 76 | + "data": { |
| 77 | + "text/plain": [ |
| 78 | + "Sapiens 4\n", |
| 79 | + "Shoe Dog 3\n", |
| 80 | + "1984 3\n", |
| 81 | + "The Rosie Project 3\n", |
| 82 | + "Ghachar Ghochar 3\n", |
| 83 | + "Ready Player One 3\n", |
| 84 | + "Leila 3\n", |
| 85 | + "A Thousand Splendid Suns 2\n", |
| 86 | + "Three Body Problem 2\n", |
| 87 | + "Children of Time 2\n", |
| 88 | + "Norwegian Wood 2\n", |
| 89 | + "Zero to One 2\n", |
| 90 | + "Neverwhere 2\n", |
| 91 | + "A Suitable Boy 2\n", |
| 92 | + "City of Djinns 2\n", |
| 93 | + "Deep Work 2\n", |
| 94 | + "Norse Mythology 2\n", |
| 95 | + "Sacred Games 2\n", |
| 96 | + "The Shadow Rising 2\n", |
| 97 | + "Man’s Search for Meaning 2\n", |
| 98 | + "Steve Jobs 2\n", |
| 99 | + "The Dresden Files 2\n", |
| 100 | + "Dogs of War 2\n", |
| 101 | + "The Great Indian Novel 2\n", |
| 102 | + "Ender’s Game 2\n", |
| 103 | + "The Game 2\n", |
| 104 | + "2001 A Space Odyssey 2\n", |
| 105 | + "The Martian 2\n", |
| 106 | + "Outliers 2\n", |
| 107 | + "The Audacity of Hope 1\n", |
| 108 | + " ..\n", |
| 109 | + "Selfish Gene - 1\n", |
| 110 | + "Timeline - 1\n", |
| 111 | + "The Taj Trilogy 1\n", |
| 112 | + "Eleanor Oliphant Is Completely Fine 1\n", |
| 113 | + "Midnight’s Children 1\n", |
| 114 | + "Faiz Ahmed Faiz Poems 1\n", |
| 115 | + "Colorless Tsukuru Tazaki and His Years of Pilgrimage 1\n", |
| 116 | + "Guards Guards 1\n", |
| 117 | + "The Dragon Reborn 1\n", |
| 118 | + "The Vegetarian 1\n", |
| 119 | + "Zen and the Art of Motorcycle Maintenance 1\n", |
| 120 | + "The Interpreter of Maladies 1\n", |
| 121 | + "Malgudi Days 1\n", |
| 122 | + "Skin in the game 1\n", |
| 123 | + "The ministry of utmost happiness 1\n", |
| 124 | + "The Illicit Happiness of Others 1\n", |
| 125 | + "WoT 1\n", |
| 126 | + "Sabriel 1\n", |
| 127 | + "Blood Sweat and Pixels 1\n", |
| 128 | + "The Demon hunt of Chottanikkara 1\n", |
| 129 | + "Red Rising 1\n", |
| 130 | + "Blind Willow Sleeping Woman 1\n", |
| 131 | + "Narcopolis 1\n", |
| 132 | + "Edge of Physics 1\n", |
| 133 | + "Thinking Fast 1\n", |
| 134 | + "Sandman 1\n", |
| 135 | + "Aristotle and Dante Discover The Secrets of the Universe 1\n", |
| 136 | + "Time Machine 1\n", |
| 137 | + "Gene 1\n", |
| 138 | + "Artemis 1\n", |
| 139 | + "Name: Title, Length: 399, dtype: int64" |
| 140 | + ] |
| 141 | + }, |
| 142 | + "execution_count": 15, |
| 143 | + "metadata": {}, |
| 144 | + "output_type": "execute_result" |
| 145 | + } |
| 146 | + ], |
| 147 | + "source": [ |
| 148 | + "books['Title'].value_counts()\n" |
| 149 | + ] |
| 150 | + }, |
| 151 | + { |
| 152 | + "cell_type": "code", |
| 153 | + "execution_count": 18, |
| 154 | + "metadata": {}, |
| 155 | + "outputs": [ |
| 156 | + { |
| 157 | + "data": { |
| 158 | + "text/plain": [ |
| 159 | + "Month\n", |
| 160 | + "1 60\n", |
| 161 | + "2 4\n", |
| 162 | + "4 15\n", |
| 163 | + "5 68\n", |
| 164 | + "6 84\n", |
| 165 | + "7 85\n", |
| 166 | + "8 30\n", |
| 167 | + "11 90\n", |
| 168 | + "Name: Sl No, dtype: int64" |
| 169 | + ] |
| 170 | + }, |
| 171 | + "execution_count": 18, |
| 172 | + "metadata": {}, |
| 173 | + "output_type": "execute_result" |
| 174 | + } |
| 175 | + ], |
| 176 | + "source": [ |
| 177 | + "books.groupby(books.Month).count()['Sl No']" |
| 178 | + ] |
| 179 | + }, |
| 180 | + { |
| 181 | + "cell_type": "code", |
| 182 | + "execution_count": null, |
| 183 | + "metadata": {}, |
| 184 | + "outputs": [], |
| 185 | + "source": [] |
| 186 | + } |
| 187 | + ], |
| 188 | + "metadata": { |
| 189 | + "kernelspec": { |
| 190 | + "display_name": "Python 3", |
| 191 | + "language": "python", |
| 192 | + "name": "python3" |
| 193 | + }, |
| 194 | + "language_info": { |
| 195 | + "codemirror_mode": { |
| 196 | + "name": "ipython", |
| 197 | + "version": 3 |
| 198 | + }, |
| 199 | + "file_extension": ".py", |
| 200 | + "mimetype": "text/x-python", |
| 201 | + "name": "python", |
| 202 | + "nbconvert_exporter": "python", |
| 203 | + "pygments_lexer": "ipython3", |
| 204 | + "version": "3.5.2" |
| 205 | + } |
| 206 | + }, |
| 207 | + "nbformat": 4, |
| 208 | + "nbformat_minor": 2 |
| 209 | +} |
0 commit comments