In [1]:
import pandas as pd
Create A Series Object from A Python List¶
In [5]:
ice_cream = ["Chocolate", "Vanilla", "Strawberry", "Rum Raisin"]
pd.Series(ice_cream)
Out[5]:
0 Chocolate 1 Vanilla 2 Strawberry 3 Rum Raisin dtype: object
In [6]:
lottery = [4, 8, 15, 16, 23, 42]
pd.Series(lottery)
Out[6]:
0 4 1 8 2 15 3 16 4 23 5 42 dtype: int64
In [7]:
registrations = [True, False, False, False, True]
pd.Series(registrations)
Out[7]:
0 True 1 False 2 False 3 False 4 True dtype: bool
Create A Series Object from a Dictionary¶
In [5]:
webster = {"Aardvark" : "An animal",
"Banana" : "A delicious fruit",
"Cyan" : "A color"}
pd.Series(webster)
Out[5]:
Aardvark An animal Banana A delicious fruit Cyan A color dtype: object
Intro to Attributes¶
In [8]:
about_me = ["Smart", "Handsome", "Charming", "Brilliant", "Humble"]
s = pd.Series(about_me)
s
Out[8]:
0 Smart 1 Handsome 2 Charming 3 Brilliant 4 Humble dtype: object
In [9]:
s.values
Out[9]:
array(['Smart', 'Handsome', 'Charming', 'Brilliant', 'Humble'], dtype=object)
In [10]:
s.index
Out[10]:
RangeIndex(start=0, stop=5, step=1)
In [11]:
s.dtype
Out[11]:
dtype('O')Intro to Methods¶
In [13]:
prices = [2.99, 4.45, 1.36]
s = pd.Series(prices)
s
Out[13]:
0 2.99 1 4.45 2 1.36 dtype: float64
In [14]:
s.sum()
Out[14]:
8.8
In [15]:
s.product()
Out[15]:
18.095480000000006
In [16]:
s.mean()
Out[16]:
2.9333333333333336
Parameters and Arguments¶
In [ ]:
# Difficulty - Easy, Medium, Hard
# Volume - 1 through 10
# Subtitles - True / False
In [21]:
fruits = ["Apple", "Orange", "Plum", "Grape", "Blueberry"]
weekdays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
pd.Series(fruits, weekdays)
pd.Series(data = fruits, index = weekdays)
pd.Series(fruits, index = weekdays)
Out[21]:
Monday Apple Tuesday Orange Wednesday Plum Thursday Grape Friday Blueberry dtype: object
In [22]:
fruits = ["Apple", "Orange", "Plum", "Grape", "Blueberry", "Watermelon"]
weekdays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Monday"]
pd.Series(data = fruits, index = weekdays)
Out[22]:
Monday Apple Tuesday Orange Wednesday Plum Thursday Grape Friday Blueberry Monday Watermelon dtype: object
Import Series with the read_csv Method¶
In [27]:
pokemon = pd.read_csv("pokemon.csv", usecols = ["Pokemon"], squeeze = True)
pokemon
Out[27]:
0 Bulbasaur
1 Ivysaur
2 Venusaur
3 Charmander
4 Charmeleon
5 Charizard
6 Squirtle
7 Wartortle
8 Blastoise
9 Caterpie
10 Metapod
11 Butterfree
12 Weedle
13 Kakuna
14 Beedrill
15 Pidgey
16 Pidgeotto
17 Pidgeot
18 Rattata
19 Raticate
20 Spearow
21 Fearow
22 Ekans
23 Arbok
24 Pikachu
25 Raichu
26 Sandshrew
27 Sandslash
28 Nidoran
29 Nidorina
...
691 Clauncher
692 Clawitzer
693 Helioptile
694 Heliolisk
695 Tyrunt
696 Tyrantrum
697 Amaura
698 Aurorus
699 Sylveon
700 Hawlucha
701 Dedenne
702 Carbink
703 Goomy
704 Sliggoo
705 Goodra
706 Klefki
707 Phantump
708 Trevenant
709 Pumpkaboo
710 Gourgeist
711 Bergmite
712 Avalugg
713 Noibat
714 Noivern
715 Xerneas
716 Yveltal
717 Zygarde
718 Diancie
719 Hoopa
720 Volcanion
Name: Pokemon, dtype: objectIn [30]:
google = pd.read_csv("google_stock_price.csv", squeeze = True)
google
Out[30]:
0 50.12
1 54.10
2 54.65
3 52.38
4 52.95
5 53.90
6 53.02
7 50.95
8 51.13
9 50.07
10 50.70
11 49.95
12 50.74
13 51.10
14 51.10
15 52.61
16 53.70
17 55.69
18 55.94
19 56.93
20 58.69
21 59.62
22 58.86
23 59.13
24 60.35
25 59.86
26 59.07
27 63.37
28 65.47
29 64.74
...
2982 675.22
2983 668.26
2984 680.04
2985 684.11
2986 692.10
2987 699.21
2988 694.49
2989 697.77
2990 695.36
2991 705.63
2992 715.09
2993 720.64
2994 716.98
2995 720.95
2996 719.85
2997 733.78
2998 736.96
2999 741.19
3000 738.63
3001 742.74
3002 739.77
3003 738.42
3004 741.77
3005 745.91
3006 768.79
3007 772.88
3008 771.07
3009 773.18
3010 771.61
3011 782.22
Name: Stock Price, dtype: float64 The .head() and .tail() Methods¶
In [31]:
pokemon = pd.read_csv("pokemon.csv", usecols = ["Pokemon"], squeeze = True)
google = pd.read_csv("google_stock_price.csv", squeeze = True)
In [36]:
pokemon.head(1)
Out[36]:
0 Bulbasaur Name: Pokemon, dtype: object
In [40]:
google.tail(1)
Out[40]:
3011 782.22 Name: Stock Price, dtype: float64
Python Built-In Functions¶
In [54]:
pokemon = pd.read_csv("pokemon.csv", usecols = ["Pokemon"], squeeze = True)
google = pd.read_csv("google_stock_price.csv", squeeze = True)
In [56]:
len(pokemon)
len(google)
Out[56]:
3012
In [57]:
type(pokemon)
Out[57]:
pandas.core.series.Series
In [58]:
dir(pokemon)
Out[58]:
['T', '_AXIS_ALIASES', '_AXIS_IALIASES', '_AXIS_LEN', '_AXIS_NAMES', '_AXIS_NUMBERS', '_AXIS_ORDERS', '_AXIS_REVERSED', '_AXIS_SLICEMAP', '__abs__', '__add__', '__and__', '__array__', '__array_prepare__', '__array_priority__', '__array_wrap__', '__bool__', '__bytes__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dict__', '__dir__', '__div__', '__doc__', '__eq__', '__finalize__', '__float__', '__floordiv__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__getitem__', '__getstate__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__int__', '__invert__', '__ipow__', '__isub__', '__iter__', '__itruediv__', '__le__', '__len__', '__long__', '__lt__', '__mod__', '__module__', '__mul__', '__ne__', '__neg__', '__new__', '__nonzero__', '__or__', '__pow__', '__radd__', '__rand__', '__rdiv__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__setitem__', '__setstate__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__unicode__', '__weakref__', '__xor__', '_accessors', '_add_numeric_operations', '_add_series_only_operations', '_add_series_or_dataframe_operations', '_agg_by_level', '_align_frame', '_align_series', '_allow_index_ops', '_at', '_binop', '_box_item_values', '_can_hold_na', '_check_inplace_setting', '_check_is_chained_assignment_possible', '_check_percentile', '_check_setitem_copy', '_clear_item_cache', '_consolidate_inplace', '_construct_axes_dict', '_construct_axes_dict_for_slice', '_construct_axes_dict_from', '_construct_axes_from_arguments', '_constructor', '_constructor_expanddim', '_constructor_sliced', '_convert', '_create_indexer', '_dir_additions', '_dir_deletions', '_expand_axes', '_from_axes', '_get_axis', '_get_axis_name', '_get_axis_number', '_get_axis_resolvers', '_get_block_manager_axis', '_get_bool_data', '_get_cacher', '_get_index_resolvers', '_get_item_cache', '_get_numeric_data', '_get_repr', '_get_values', '_get_values_tuple', '_get_with', '_iat', '_iget_item_cache', '_iloc', '_index', '_indexed_same', '_info_axis', '_info_axis_name', '_info_axis_number', '_init_mgr', '_internal_names', '_internal_names_set', '_is_cached', '_is_datelike_mixed_type', '_is_mixed_type', '_is_numeric_mixed_type', '_is_view', '_ix', '_ixs', '_loc', '_make_cat_accessor', '_make_dt_accessor', '_make_str_accessor', '_maybe_cache_changed', '_maybe_update_cacher', '_metadata', '_needs_reindex_multi', '_protect_consolidate', '_reduce', '_reindex_axes', '_reindex_axis', '_reindex_indexer', '_reindex_multi', '_reindex_with_indexers', '_reset_cache', '_reset_cacher', '_set_as_cached', '_set_axis', '_set_axis_name', '_set_is_copy', '_set_item', '_set_labels', '_set_name', '_set_subtyp', '_set_values', '_set_with', '_set_with_engine', '_setup_axes', '_slice', '_stat_axis', '_stat_axis_name', '_stat_axis_number', '_typ', '_unpickle_series_compat', '_update_inplace', '_validate_dtype', '_values', '_xs', 'abs', 'add', 'add_prefix', 'add_suffix', 'align', 'all', 'any', 'append', 'apply', 'argmax', 'argmin', 'argsort', 'as_blocks', 'as_matrix', 'asfreq', 'asobject', 'asof', 'astype', 'at', 'at_time', 'autocorr', 'axes', 'base', 'between', 'between_time', 'bfill', 'blocks', 'bool', 'clip', 'clip_lower', 'clip_upper', 'combine', 'combine_first', 'compound', 'compress', 'consolidate', 'convert_objects', 'copy', 'corr', 'count', 'cov', 'cummax', 'cummin', 'cumprod', 'cumsum', 'data', 'describe', 'diff', 'div', 'divide', 'dot', 'drop', 'drop_duplicates', 'dropna', 'dtype', 'dtypes', 'duplicated', 'empty', 'eq', 'equals', 'ewm', 'expanding', 'factorize', 'ffill', 'fillna', 'filter', 'first', 'first_valid_index', 'flags', 'floordiv', 'from_array', 'from_csv', 'ftype', 'ftypes', 'ge', 'get', 'get_dtype_counts', 'get_ftype_counts', 'get_value', 'get_values', 'groupby', 'gt', 'hasnans', 'head', 'hist', 'iat', 'idxmax', 'idxmin', 'iget', 'iget_value', 'iloc', 'imag', 'index', 'interpolate', 'irow', 'is_copy', 'is_time_series', 'is_unique', 'isin', 'isnull', 'item', 'items', 'itemsize', 'iteritems', 'iterkv', 'ix', 'keys', 'kurt', 'kurtosis', 'last', 'last_valid_index', 'le', 'loc', 'lt', 'mad', 'map', 'mask', 'max', 'mean', 'median', 'memory_usage', 'min', 'mod', 'mode', 'mul', 'multiply', 'name', 'nbytes', 'ndim', 'ne', 'nlargest', 'nonzero', 'notnull', 'nsmallest', 'nunique', 'order', 'pct_change', 'pipe', 'plot', 'pop', 'pow', 'prod', 'product', 'ptp', 'put', 'quantile', 'radd', 'rank', 'ravel', 'rdiv', 'real', 'reindex', 'reindex_axis', 'reindex_like', 'rename', 'rename_axis', 'reorder_levels', 'repeat', 'replace', 'resample', 'reset_index', 'reshape', 'rfloordiv', 'rmod', 'rmul', 'rolling', 'round', 'rpow', 'rsub', 'rtruediv', 'sample', 'searchsorted', 'select', 'sem', 'set_axis', 'set_value', 'shape', 'shift', 'size', 'skew', 'slice_shift', 'sort', 'sort_index', 'sort_values', 'sortlevel', 'squeeze', 'std', 'str', 'strides', 'sub', 'subtract', 'sum', 'swapaxes', 'swaplevel', 'tail', 'take', 'to_clipboard', 'to_csv', 'to_dense', 'to_dict', 'to_frame', 'to_hdf', 'to_json', 'to_msgpack', 'to_period', 'to_pickle', 'to_sparse', 'to_sql', 'to_string', 'to_timestamp', 'to_xarray', 'tolist', 'transpose', 'truediv', 'truncate', 'tshift', 'tz_convert', 'tz_localize', 'unique', 'unstack', 'update', 'valid', 'value_counts', 'values', 'var', 'view', 'where', 'xs']
In [60]:
sorted(pokemon)
sorted(google)
Out[60]:
[49.950000000000003, 50.07, 50.119999999999997, 50.700000000000003, 50.740000000000002, 50.950000000000003, 51.100000000000001, 51.100000000000001, 51.130000000000003, 52.380000000000003, 52.609999999999999, 52.950000000000003, 53.020000000000003, 53.700000000000003, 53.899999999999999, 54.100000000000001, 54.649999999999999, 55.689999999999998, 55.939999999999998, 56.93, 58.689999999999998, 58.859999999999999, 59.07, 59.130000000000003, 59.619999999999997, 59.859999999999999, 60.350000000000001, 63.369999999999997, 64.739999999999995, 65.469999999999999, 66.219999999999999, 67.459999999999994, 67.560000000000002, 68.469999999999999, 68.629999999999995, 68.799999999999997, 69.120000000000005, 69.359999999999999, 70.170000000000002, 70.379999999999995, 70.930000000000007, 71.980000000000004, 73.900000000000006, 74.510000000000005, 74.620000000000005, 82.469999999999999, 83.680000000000007, 83.689999999999998, 83.849999999999994, 84.269999999999996, 84.590000000000003, 84.620000000000005, 84.909999999999997, 85.140000000000001, 85.629999999999995, 85.739999999999995, 86.129999999999995, 86.159999999999997, 86.189999999999998, 86.189999999999998, 86.629999999999995, 87.290000000000006, 87.409999999999997, 87.709999999999994, 88.060000000000002, 88.150000000000006, 88.469999999999999, 88.810000000000002, 89.209999999999994, 89.219999999999999, 89.260000000000005, 89.400000000000006, 89.540000000000006, 89.560000000000002, 89.609999999999999, 89.609999999999999, 89.700000000000003, 89.799999999999997, 89.890000000000001, 89.900000000000006, 89.930000000000007, 89.930000000000007, 89.950000000000003, 90.109999999999999, 90.129999999999995, 90.159999999999997, 90.269999999999996, 90.349999999999994, 90.430000000000007, 90.579999999999998, 90.620000000000005, 90.810000000000002, 90.900000000000006, 90.909999999999997, 91.420000000000002, 91.780000000000001, 92.260000000000005, 92.340000000000003, 92.409999999999997, 92.420000000000002, 92.5, 92.510000000000005, 92.549999999999997, 92.840000000000003, 92.859999999999999, 92.890000000000001, 92.939999999999998, 93.060000000000002, 93.390000000000001, 93.409999999999997, 93.609999999999999, 93.609999999999999, 93.859999999999999, 93.900000000000006, 93.900000000000006, 93.950000000000003, 94.049999999999997, 94.180000000000007, 94.189999999999998, 94.310000000000002, 94.349999999999994, 94.519999999999996, 94.530000000000001, 95.069999999999993, 95.219999999999999, 95.590000000000003, 95.599999999999994, 95.629999999999995, 95.689999999999998, 95.739999999999995, 95.849999999999994, 95.859999999999999, 95.930000000000007, 96.280000000000001, 96.299999999999997, 96.349999999999994, 96.370000000000005, 96.400000000000006, 96.519999999999996, 96.549999999999997, 96.659999999999997, 96.670000000000002, 96.780000000000001, 96.829999999999998, 96.859999999999999, 96.879999999999995, 96.879999999999995, 97.150000000000006, 97.340000000000003, 97.430000000000007, 97.519999999999996, 97.569999999999993, 97.590000000000003, 97.709999999999994, 97.920000000000002, 97.920000000000002, 98.549999999999997, 98.700000000000003, 98.849999999999994, 98.879999999999995, 98.950000000000003, 99.109999999999999, 99.219999999999999, 99.890000000000001, 101.25, 101.84999999999999, 102.01000000000001, 102.08, 102.88, 105.31999999999999, 107.8, 109.27, 109.62, 109.78, 109.89, 111.03, 111.65000000000001, 112.90000000000001, 112.98, 113.38, 113.79000000000001, 113.90000000000001, 114.14, 114.25, 114.51000000000001, 115.41, 115.53, 116.45, 119.45999999999999, 119.47, 120.68000000000001, 127.59999999999999, 127.87, 128.59, 129.47, 129.65000000000001, 130.27000000000001, 131.08000000000001, 132.86000000000001, 132.87, 136.87, 137.03, 137.25999999999999, 137.41999999999999, 138.5, 138.58000000000001, 139.03999999999999, 139.58000000000001, 139.63999999999999, 139.65000000000001, 139.86000000000001, 139.86000000000001, 139.94999999999999, 139.99000000000001, 140.0, 140.88, 141.11000000000001, 141.13999999999999, 141.15000000000001, 141.22999999999999, 141.22999999999999, 141.65000000000001, 141.84999999999999, 141.86000000000001, 141.88, 142.41, 142.68000000000001, 142.69999999999999, 142.86000000000001, 142.97999999999999, 143.00999999999999, 143.21000000000001, 143.41, 143.49000000000001, 143.74000000000001, 143.78, 143.81, 143.86000000000001, 144.08000000000001, 144.08000000000001, 144.50999999999999, 144.71000000000001, 144.72, 145.30000000000001, 145.31999999999999, 145.34999999999999, 145.47999999999999, 145.47999999999999, 145.62, 145.63999999999999, 145.66, 145.75, 145.90000000000001, 146.03, 146.21000000000001, 146.33000000000001, 146.41, 146.53, 146.59999999999999, 146.93000000000001, 147.28999999999999, 147.55000000000001, 147.62, 147.71000000000001, 147.78, 147.90000000000001, 147.91999999999999, 147.97, 148.31999999999999, 148.41, 148.47999999999999, 148.5, 148.56, 148.56, 148.56999999999999, 148.72, 148.86000000000001, 149.28, 149.34999999999999, 149.40000000000001, 149.44999999999999, 149.62, 149.69, 149.91, 149.94999999999999, 149.96000000000001, 150.03, 150.28999999999999, 150.33000000000001, 150.33000000000001, 150.44, 150.84999999999999, 150.90000000000001, 151.05000000000001, 151.16, 151.31999999999999, 151.34999999999999, 151.38999999999999, 151.40000000000001, 151.44999999999999, 151.49000000000001, 151.74000000000001, 151.90000000000001, 152.34999999999999, 152.66999999999999, 152.83000000000001, 152.84999999999999, 152.90000000000001, 153.09999999999999, 153.66999999999999, 153.80000000000001, 153.93000000000001, 154.13, 154.19999999999999, 154.25999999999999, 154.66, 154.72, 154.80000000000001, 154.84999999999999, 154.93000000000001, 154.97999999999999, 155.16999999999999, 155.18000000000001, 155.19999999999999, 155.34, 155.53, 155.56999999999999, 155.68000000000001, 155.78999999999999, 155.84, 155.88, 156.19, 156.22, 156.34, 156.81, 156.81, 156.97999999999999, 157.0, 157.38, 157.46000000000001, 157.52000000000001, 157.72, 158.06999999999999, 158.80000000000001, 159.18000000000001, 159.22999999999999, 159.30000000000001, 159.69, 160.5, 160.84, 161.59999999999999, 161.77000000000001, 162.05000000000001, 162.19, 162.43000000000001, 162.47999999999999, 162.58000000000001, 163.41999999999999, 163.86000000000001, 164.33000000000001, 164.58000000000001, 164.81, 164.86000000000001, 164.91, 165.40000000000001, 165.44, 165.56999999999999, 165.83000000000001, 166.38, 166.86000000000001, 167.5, 168.36000000000001, 168.41999999999999, 168.58000000000001, 168.83000000000001, 168.88999999999999, 169.09999999999999, 169.22, 169.41999999999999, 169.47999999999999, 169.72999999999999, 169.78, 169.78999999999999, 169.94, 170.05000000000001, 170.11000000000001, 170.65000000000001, 170.77000000000001, 170.94999999999999, 171.02000000000001, 171.15000000000001, 171.16, 171.16999999999999, 171.33000000000001, 171.33000000000001, 171.49000000000001, 171.49000000000001, 171.86000000000001, 172.08000000000001, 172.55000000000001, 172.68000000000001, 172.83000000000001, 173.05000000000001, 173.06999999999999, 173.28, 173.41, 173.68000000000001, 173.86000000000001, 173.91999999999999, 174.13, 174.15000000000001, 174.16, 175.40000000000001, 175.97999999999999, 176.33000000000001, 176.34999999999999, 176.38, 176.47, 176.68000000000001, 176.75999999999999, 176.87, 177.53999999999999, 177.66, 178.66, 178.81999999999999, 178.84, 178.91, 179.08000000000001, 179.15000000000001, 179.21000000000001, 179.5, 179.66999999999999, 180.81999999999999, 181.06999999999999, 181.12, 181.13, 181.16999999999999, 181.19, 181.34, 182.03999999999999, 182.22, 182.56, 182.72, 183.05000000000001, 183.11000000000001, 183.28999999999999, 183.43000000000001, 183.78, 183.87, 183.94, 184.06999999999999, 184.19, 184.19, 184.27000000000001, 184.36000000000001, 184.53, 184.66, 184.71000000000001, 184.81999999999999, 185.28999999999999, 185.31, 185.41999999999999, 185.44999999999999, 185.46000000000001, 185.72, 185.78, 185.88, 186.06, 186.08000000000001, 186.44, 186.53, 186.68000000000001, 186.74000000000001, 186.88, 186.91, 187.03, 187.06, 187.50999999999999, 187.56999999999999, 187.59999999999999, 187.91, 188.03999999999999, 188.28, 188.41, 188.46000000000001, 188.50999999999999, 188.74000000000001, 188.78999999999999, 188.84999999999999, 188.87, 188.90000000000001, 188.96000000000001, 189.06, 189.08000000000001, 189.11000000000001, 189.19999999999999, 189.28999999999999, 189.38999999999999, 189.46000000000001, 189.47, 189.5, 189.53, 189.56, 189.65000000000001, 189.88, 190.18000000000001, 190.28, 190.28999999999999, 190.31, 190.31, 190.31999999999999, 190.43000000000001, 190.47999999999999, 190.53999999999999, 190.58000000000001, 190.59, 191.00999999999999, 191.12, 191.30000000000001, 191.49000000000001, 191.66, 191.74000000000001, 191.84999999999999, 191.99000000000001, 192.0, 192.15000000000001, 192.36000000000001, 192.56, 192.71000000000001, 192.78, 192.78, 193.06, 193.06999999999999, 193.09, 193.11000000000001, 193.25999999999999, 193.31, 193.37, 193.38999999999999, 193.56, 193.66999999999999, 193.87, 193.88, 194.03, 194.18000000000001, 194.49000000000001, 194.55000000000001, 194.58000000000001, 194.66, 194.75999999999999, 194.80000000000001, 194.80000000000001, 194.80000000000001, 194.86000000000001, 194.99000000000001, 195.0, 195.02000000000001, 195.05000000000001, 195.15000000000001, 195.25, 195.30000000000001, 195.34999999999999, 195.53999999999999, 195.75, 195.91999999999999, 196.19999999999999, 196.44999999999999, 196.55000000000001, 196.65000000000001, 196.88999999999999, 196.94999999999999, 197.18000000000001, 197.19, 197.19999999999999, 197.28999999999999, 197.31999999999999, 197.78999999999999, 197.81999999999999, 198.05000000000001, 198.11000000000001, 198.12, 198.22, 198.28999999999999, 198.30000000000001, 198.38999999999999, 198.88, 199.24000000000001, 199.25, 199.30000000000001, 199.31, 199.53, 199.78, 199.90000000000001, 200.06, 200.52000000000001, 200.69, 200.75, 200.78999999999999, 200.86000000000001, 200.88, 200.96000000000001, 201.03999999999999, 201.25999999999999, 201.28999999999999, 201.28999999999999, 201.31999999999999, 201.52000000000001, 201.53, 201.55000000000001, 201.56999999999999, 201.59, 201.69, 201.69999999999999, 201.78999999999999, 201.78999999999999, 201.81999999999999, 201.91, 201.91, 201.91999999999999, 201.97, 201.97999999999999, 202.06999999999999, 202.22999999999999, 202.25, 202.58000000000001, 202.63999999999999, 202.72, 202.84999999999999, 202.88, 203.08000000000001, 203.21000000000001, 203.22, 203.22999999999999, 203.46000000000001, 203.47, 203.74000000000001, 203.78999999999999, 203.78999999999999, 204.03999999999999, 204.19999999999999, 204.21000000000001, 204.27000000000001, 204.40000000000001, 204.44, 204.47999999999999, 204.59999999999999, 204.63, 204.74000000000001, 204.99000000000001, 204.99000000000001, 205.03999999999999, 205.12, 205.38, 205.65000000000001, 205.69999999999999, 206.09999999999999, 206.59999999999999, 206.81999999999999, 206.84, 206.87, 206.99000000000001, 207.03999999999999, 207.13999999999999, 207.22, 207.28999999999999, 207.37, 207.63999999999999, 207.68000000000001, 207.78999999999999, 207.97999999999999, 208.03, 208.18000000000001, 208.41, 208.41999999999999, 208.53999999999999, 208.63999999999999, 208.69999999999999, 208.75999999999999, 208.88999999999999, 209.12, 209.27000000000001, 209.28999999999999, 209.44, 209.46000000000001, 209.72999999999999, 209.75999999999999, 209.80000000000001, 209.83000000000001, 209.86000000000001, 210.00999999999999, 210.03999999999999, 210.11000000000001, 210.52000000000001, 210.58000000000001, 210.66, 211.05000000000001, 211.22, 211.38, 211.38999999999999, 211.53, 211.86000000000001, 211.94, 212.06999999999999, 212.09, 212.11000000000001, 212.13, 212.21000000000001, 212.44999999999999, 212.77000000000001, 212.81999999999999, 212.94999999999999, 213.03999999999999, 213.06999999999999, 213.11000000000001, 213.13, 213.19999999999999, 213.37, 213.44, 213.50999999999999, 213.53999999999999, 213.63, 213.74000000000001, 213.99000000000001, 214.09999999999999, 214.28999999999999, 214.28999999999999, 214.41999999999999, 214.66, 214.84999999999999, 214.86000000000001, 214.87, 214.91, 215.25, 215.30000000000001, 215.61000000000001, 215.78, 215.80000000000001, 216.08000000000001, 216.11000000000001, 216.13, 216.28, 216.46000000000001, 216.53, 216.56, 216.66, 216.71000000000001, 216.91999999999999, 217.34, 217.40000000000001, 217.59, 217.81999999999999, 217.90000000000001, 218.0, 218.06, 218.33000000000001, 218.44999999999999, 218.61000000000001, 218.74000000000001, 218.81999999999999, 218.87, 219.12, 219.16999999999999, 219.31999999999999, 219.36000000000001, 219.53, 219.58000000000001, 219.69999999999999, 219.71000000000001, 219.87, 219.91999999999999, 220.00999999999999, 220.03, 220.19999999999999, 220.25, 221.08000000000001, 221.24000000000001, 221.28, 221.28999999999999, 221.28999999999999, 221.30000000000001, 221.75999999999999, 221.81999999999999, 221.90000000000001, 221.94, 222.08000000000001, 222.18000000000001, 222.22, 222.22999999999999, 222.25, 222.40000000000001, 222.41999999999999, 222.41999999999999, 222.59999999999999, 222.87, 223.13999999999999, 223.19999999999999, 223.38999999999999, 223.63, 223.78, 223.88999999999999, 224.16, 224.34999999999999, 224.5, 224.55000000000001, 224.78, 224.87, 224.90000000000001, 224.94999999999999, 225.16, 225.25999999999999, 225.34, 225.38999999999999, 225.47, 225.59999999999999, 225.88, 226.12, 226.25, 226.28, 226.63999999999999, 226.74000000000001, 226.90000000000001, 227.08000000000001, 227.13, 227.15000000000001, 227.28999999999999, 227.33000000000001, 227.56, 227.59, 227.65000000000001, 227.87, 228.05000000000001, 228.05000000000001, 228.08000000000001, 228.28, 228.31999999999999, 228.5, 228.53, 228.53999999999999, 228.55000000000001, 228.77000000000001, 228.84999999999999, 228.87, 228.91999999999999, 229.03999999999999, 229.06, 229.08000000000001, 229.19, 229.31999999999999, 229.56999999999999, 229.61000000000001, 229.77000000000001, 229.94, 229.97, 230.00999999999999, 230.05000000000001, 230.22999999999999, 230.41999999999999, 230.5, 230.5, 230.59999999999999, 230.66, 230.68000000000001, 230.71000000000001, 230.71000000000001, 230.78, 230.78999999999999, 230.91, 231.05000000000001, 231.16999999999999, 231.22, 231.27000000000001, 231.36000000000001, 231.41, 231.58000000000001, 231.58000000000001, 231.75, 231.80000000000001, 231.86000000000001, 231.86000000000001, 231.97, 231.97, 232.03, 232.13999999999999, 232.22999999999999, 232.27000000000001, 232.38999999999999, 232.38999999999999, 232.59999999999999, 232.62, 232.62, 232.66, 232.72999999999999, 232.80000000000001, 232.86000000000001, 232.88999999999999, 232.91, 233.02000000000001, 233.13999999999999, 233.16999999999999, 233.22, 233.31999999999999, 233.34999999999999, 233.40000000000001, 233.46000000000001, 233.50999999999999, 233.52000000000001, 233.56, 233.66999999999999, 233.69999999999999, 233.75, 233.77000000000001, 233.78, 233.87, 234.06, 234.08000000000001, 234.13, 234.16999999999999, 234.27000000000001, 234.30000000000001, 234.38999999999999, 234.65000000000001, 234.72, 234.74000000000001, 234.77000000000001, 234.91, 234.91999999999999, 235.05000000000001, 235.06, 235.06999999999999, 235.22999999999999, 235.24000000000001, 235.27000000000001, 235.28, 235.31, 235.31999999999999, 235.34999999999999, 235.44999999999999, 235.44999999999999, 235.5, 235.52000000000001, 235.58000000000001, 235.59, 235.66, 235.78999999999999, 235.80000000000001, 235.81, 235.83000000000001, 236.05000000000001, 236.06, 236.06999999999999, 236.08000000000001, 236.09999999999999, 236.16, 236.19, 236.38, 236.41999999999999, 236.53999999999999, 236.63999999999999, 236.65000000000001, 236.75, 236.77000000000001, 236.84, 236.90000000000001, 236.93000000000001, 237.19999999999999, 237.25999999999999, 237.27000000000001, 237.31, 237.31999999999999, 237.36000000000001, 237.46000000000001, 237.5, 237.56999999999999, 237.68000000000001, 237.69, 237.69, 237.69, 237.77000000000001, 237.83000000000001, 237.84999999999999, 237.96000000000001, 238.05000000000001, 238.16999999999999, 238.24000000000001, 238.30000000000001, 238.31999999999999, 238.31999999999999, 238.34, 238.50999999999999, 238.53, 238.53, 238.75999999999999, 239.25999999999999, 239.27000000000001, 239.28999999999999, 239.30000000000001, 239.31999999999999, 239.69, 239.87, 239.91, ...]
In [61]:
list(pokemon)
Out[61]:
['Bulbasaur', 'Ivysaur', 'Venusaur', 'Charmander', 'Charmeleon', 'Charizard', 'Squirtle', 'Wartortle', 'Blastoise', 'Caterpie', 'Metapod', 'Butterfree', 'Weedle', 'Kakuna', 'Beedrill', 'Pidgey', 'Pidgeotto', 'Pidgeot', 'Rattata', 'Raticate', 'Spearow', 'Fearow', 'Ekans', 'Arbok', 'Pikachu', 'Raichu', 'Sandshrew', 'Sandslash', 'Nidoran', 'Nidorina', 'Nidoqueen', 'Nidoran♂', 'Nidorino', 'Nidoking', 'Clefairy', 'Clefable', 'Vulpix', 'Ninetales', 'Jigglypuff', 'Wigglytuff', 'Zubat', 'Golbat', 'Oddish', 'Gloom', 'Vileplume', 'Paras', 'Parasect', 'Venonat', 'Venomoth', 'Diglett', 'Dugtrio', 'Meowth', 'Persian', 'Psyduck', 'Golduck', 'Mankey', 'Primeape', 'Growlithe', 'Arcanine', 'Poliwag', 'Poliwhirl', 'Poliwrath', 'Abra', 'Kadabra', 'Alakazam', 'Machop', 'Machoke', 'Machamp', 'Bellsprout', 'Weepinbell', 'Victreebel', 'Tentacool', 'Tentacruel', 'Geodude', 'Graveler', 'Golem', 'Ponyta', 'Rapidash', 'Slowpoke', 'Slowbro', 'Magnemite', 'Magneton', "Farfetch'd", 'Doduo', 'Dodrio', 'Seel', 'Dewgong', 'Grimer', 'Muk', 'Shellder', 'Cloyster', 'Gastly', 'Haunter', 'Gengar', 'Onix', 'Drowzee', 'Hypno', 'Krabby', 'Kingler', 'Voltorb', 'Electrode', 'Exeggcute', 'Exeggutor', 'Cubone', 'Marowak', 'Hitmonlee', 'Hitmonchan', 'Lickitung', 'Koffing', 'Weezing', 'Rhyhorn', 'Rhydon', 'Chansey', 'Tangela', 'Kangaskhan', 'Horsea', 'Seadra', 'Goldeen', 'Seaking', 'Staryu', 'Starmie', 'Mr. Mime', 'Scyther', 'Jynx', 'Electabuzz', 'Magmar', 'Pinsir', 'Tauros', 'Magikarp', 'Gyarados', 'Lapras', 'Ditto', 'Eevee', 'Vaporeon', 'Jolteon', 'Flareon', 'Porygon', 'Omanyte', 'Omastar', 'Kabuto', 'Kabutops', 'Aerodactyl', 'Snorlax', 'Articuno', 'Zapdos', 'Moltres', 'Dratini', 'Dragonair', 'Dragonite', 'Mewtwo', 'Mew', 'Chikorita', 'Bayleef', 'Meganium', 'Cyndaquil', 'Quilava', 'Typhlosion', 'Totodile', 'Croconaw', 'Feraligatr', 'Sentret', 'Furret', 'Hoothoot', 'Noctowl', 'Ledyba', 'Ledian', 'Spinarak', 'Ariados', 'Crobat', 'Chinchou', 'Lanturn', 'Pichu', 'Cleffa', 'Igglybuff', 'Togepi', 'Togetic', 'Natu', 'Xatu', 'Mareep', 'Flaaffy', 'Ampharos', 'Bellossom', 'Marill', 'Azumarill', 'Sudowoodo', 'Politoed', 'Hoppip', 'Skiploom', 'Jumpluff', 'Aipom', 'Sunkern', 'Sunflora', 'Yanma', 'Wooper', 'Quagsire', 'Espeon', 'Umbreon', 'Murkrow', 'Slowking', 'Misdreavus', 'Unown', 'Wobbuffet', 'Girafarig', 'Pineco', 'Forretress', 'Dunsparce', 'Gligar', 'Steelix', 'Snubbull', 'Granbull', 'Qwilfish', 'Scizor', 'Shuckle', 'Heracross', 'Sneasel', 'Teddiursa', 'Ursaring', 'Slugma', 'Magcargo', 'Swinub', 'Piloswine', 'Corsola', 'Remoraid', 'Octillery', 'Delibird', 'Mantine', 'Skarmory', 'Houndour', 'Houndoom', 'Kingdra', 'Phanpy', 'Donphan', 'Porygon2', 'Stantler', 'Smeargle', 'Tyrogue', 'Hitmontop', 'Smoochum', 'Elekid', 'Magby', 'Miltank', 'Blissey', 'Raikou', 'Entei', 'Suicune', 'Larvitar', 'Pupitar', 'Tyranitar', 'Lugia', 'Ho-oh', 'Celebi', 'Treecko', 'Grovyle', 'Sceptile', 'Torchic', 'Combusken', 'Blaziken', 'Mudkip', 'Marshtomp', 'Swampert', 'Poochyena', 'Mightyena', 'Zigzagoon', 'Linoone', 'Wurmple', 'Silcoon', 'Beautifly', 'Cascoon', 'Dustox', 'Lotad', 'Lombre', 'Ludicolo', 'Seedot', 'Nuzleaf', 'Shiftry', 'Taillow', 'Swellow', 'Wingull', 'Pelipper', 'Ralts', 'Kirlia', 'Gardevoir', 'Surskit', 'Masquerain', 'Shroomish', 'Breloom', 'Slakoth', 'Vigoroth', 'Slaking', 'Nincada', 'Ninjask', 'Shedinja', 'Whismur', 'Loudred', 'Exploud', 'Makuhita', 'Hariyama', 'Azurill', 'Nosepass', 'Skitty', 'Delcatty', 'Sableye', 'Mawile', 'Aron', 'Lairon', 'Aggron', 'Meditite', 'Medicham', 'Electrike', 'Manectric', 'Plusle', 'Minun', 'Volbeat', 'Illumise', 'Roselia', 'Gulpin', 'Swalot', 'Carvanha', 'Sharpedo', 'Wailmer', 'Wailord', 'Numel', 'Camerupt', 'Torkoal', 'Spoink', 'Grumpig', 'Spinda', 'Trapinch', 'Vibrava', 'Flygon', 'Cacnea', 'Cacturne', 'Swablu', 'Altaria', 'Zangoose', 'Seviper', 'Lunatone', 'Solrock', 'Barboach', 'Whiscash', 'Corphish', 'Crawdaunt', 'Baltoy', 'Claydol', 'Lileep', 'Cradily', 'Anorith', 'Armaldo', 'Feebas', 'Milotic', 'Castform', 'Kecleon', 'Shuppet', 'Banette', 'Duskull', 'Dusclops', 'Tropius', 'Chimecho', 'Absol', 'Wynaut', 'Snorunt', 'Glalie', 'Spheal', 'Sealeo', 'Walrein', 'Clamperl', 'Huntail', 'Gorebyss', 'Relicanth', 'Luvdisc', 'Bagon', 'Shelgon', 'Salamence', 'Beldum', 'Metang', 'Metagross', 'Regirock', 'Regice', 'Registeel', 'Latias', 'Latios', 'Kyogre', 'Groudon', 'Rayquaza', 'Jirachi', 'Deoxys', 'Turtwig', 'Grotle', 'Torterra', 'Chimchar', 'Monferno', 'Infernape', 'Piplup', 'Prinplup', 'Empoleon', 'Starly', 'Staravia', 'Staraptor', 'Bidoof', 'Bibarel', 'Kricketot', 'Kricketune', 'Shinx', 'Luxio', 'Luxray', 'Budew', 'Roserade', 'Cranidos', 'Rampardos', 'Shieldon', 'Bastiodon', 'Burmy', 'Wormadam', 'Mothim', 'Combee', 'Vespiquen', 'Pachirisu', 'Buizel', 'Floatzel', 'Cherubi', 'Cherrim', 'Shellos', 'Gastrodon', 'Ambipom', 'Drifloon', 'Drifblim', 'Buneary', 'Lopunny', 'Mismagius', 'Honchkrow', 'Glameow', 'Purugly', 'Chingling', 'Stunky', 'Skuntank', 'Bronzor', 'Bronzong', 'Bonsly', 'Mime Jr.', 'Happiny', 'Chatot', 'Spiritomb', 'Gible', 'Gabite', 'Garchomp', 'Munchlax', 'Riolu', 'Lucario', 'Hippopotas', 'Hippowdon', 'Skorupi', 'Drapion', 'Croagunk', 'Toxicroak', 'Carnivine', 'Finneon', 'Lumineon', 'Mantyke', 'Snover', 'Abomasnow', 'Weavile', 'Magnezone', 'Lickilicky', 'Rhyperior', 'Tangrowth', 'Electivire', 'Magmortar', 'Togekiss', 'Yanmega', 'Leafeon', 'Glaceon', 'Gliscor', 'Mamoswine', 'Porygon-Z', 'Gallade', 'Probopass', 'Dusknoir', 'Froslass', 'Rotom', 'Uxie', 'Mesprit', 'Azelf', 'Dialga', 'Palkia', 'Heatran', 'Regigigas', 'Giratina', 'Cresselia', 'Phione', 'Manaphy', 'Darkrai', 'Shaymin', 'Arceus', 'Victini', 'Snivy', 'Servine', 'Serperior', 'Tepig', 'Pignite', 'Emboar', 'Oshawott', 'Dewott', 'Samurott', 'Patrat', 'Watchog', 'Lillipup', 'Herdier', 'Stoutland', 'Purrloin', 'Liepard', 'Pansage', 'Simisage', 'Pansear', 'Simisear', 'Panpour', 'Simipour', 'Munna', 'Musharna', 'Pidove', 'Tranquill', 'Unfezant', 'Blitzle', 'Zebstrika', 'Roggenrola', 'Boldore', 'Gigalith', 'Woobat', 'Swoobat', 'Drilbur', 'Excadrill', 'Audino', 'Timburr', 'Gurdurr', 'Conkeldurr', 'Tympole', 'Palpitoad', 'Seismitoad', 'Throh', 'Sawk', 'Sewaddle', 'Swadloon', 'Leavanny', 'Venipede', 'Whirlipede', 'Scolipede', 'Cottonee', 'Whimsicott', 'Petilil', 'Lilligant', 'Basculin', 'Sandile', 'Krokorok', 'Krookodile', 'Darumaka', 'Darmanitan', 'Maractus', 'Dwebble', 'Crustle', 'Scraggy', 'Scrafty', 'Sigilyph', 'Yamask', 'Cofagrigus', 'Tirtouga', 'Carracosta', 'Archen', 'Archeops', 'Trubbish', 'Garbodor', 'Zorua', 'Zoroark', 'Minccino', 'Cinccino', 'Gothita', 'Gothorita', 'Gothitelle', 'Solosis', 'Duosion', 'Reuniclus', 'Ducklett', 'Swanna', 'Vanillite', 'Vanillish', 'Vanilluxe', 'Deerling', 'Sawsbuck', 'Emolga', 'Karrablast', 'Escavalier', 'Foongus', 'Amoonguss', 'Frillish', 'Jellicent', 'Alomomola', 'Joltik', 'Galvantula', 'Ferroseed', 'Ferrothorn', 'Klink', 'Klang', 'Klinklang', 'Tynamo', 'Eelektrik', 'Eelektross', 'Elgyem', 'Beheeyem', 'Litwick', 'Lampent', 'Chandelure', 'Axew', 'Fraxure', 'Haxorus', 'Cubchoo', 'Beartic', 'Cryogonal', 'Shelmet', 'Accelgor', 'Stunfisk', 'Mienfoo', 'Mienshao', 'Druddigon', 'Golett', 'Golurk', 'Pawniard', 'Bisharp', 'Bouffalant', 'Rufflet', 'Braviary', 'Vullaby', 'Mandibuzz', 'Heatmor', 'Durant', 'Deino', 'Zweilous', 'Hydreigon', 'Larvesta', 'Volcarona', 'Cobalion', 'Terrakion', 'Virizion', 'Tornadus', 'Thundurus', 'Reshiram', 'Zekrom', 'Landorus', 'Kyurem', 'Keldeo', 'Meloetta', 'Genesect', 'Chespin', 'Quilladin', 'Chesnaught', 'Fennekin', 'Braixen', 'Delphox', 'Froakie', 'Frogadier', 'Greninja', 'Bunnelby', 'Diggersby', 'Fletchling', 'Fletchinder', 'Talonflame', 'Scatterbug', 'Spewpa', 'Vivillon', 'Litleo', 'Pyroar', 'Flabébé', 'Floette', 'Florges', 'Skiddo', 'Gogoat', 'Pancham', 'Pangoro', 'Furfrou', 'Espurr', 'Meowstic', 'Honedge', 'Doublade', 'Aegislash', 'Spritzee', 'Aromatisse', 'Swirlix', 'Slurpuff', 'Inkay', 'Malamar', 'Binacle', 'Barbaracle', 'Skrelp', 'Dragalge', 'Clauncher', 'Clawitzer', 'Helioptile', 'Heliolisk', 'Tyrunt', 'Tyrantrum', 'Amaura', 'Aurorus', 'Sylveon', 'Hawlucha', 'Dedenne', 'Carbink', 'Goomy', 'Sliggoo', 'Goodra', 'Klefki', 'Phantump', 'Trevenant', 'Pumpkaboo', 'Gourgeist', 'Bergmite', 'Avalugg', 'Noibat', 'Noivern', 'Xerneas', 'Yveltal', 'Zygarde', 'Diancie', 'Hoopa', 'Volcanion']
In [62]:
dict(google)
Out[62]:
{0: 50.119999999999997,
1: 54.100000000000001,
2: 54.649999999999999,
3: 52.380000000000003,
4: 52.950000000000003,
5: 53.899999999999999,
6: 53.020000000000003,
7: 50.950000000000003,
8: 51.130000000000003,
9: 50.07,
10: 50.700000000000003,
11: 49.950000000000003,
12: 50.740000000000002,
13: 51.100000000000001,
14: 51.100000000000001,
15: 52.609999999999999,
16: 53.700000000000003,
17: 55.689999999999998,
18: 55.939999999999998,
19: 56.93,
20: 58.689999999999998,
21: 59.619999999999997,
22: 58.859999999999999,
23: 59.130000000000003,
24: 60.350000000000001,
25: 59.859999999999999,
26: 59.07,
27: 63.369999999999997,
28: 65.469999999999999,
29: 64.739999999999995,
30: 66.219999999999999,
31: 67.459999999999994,
32: 69.120000000000005,
33: 68.469999999999999,
34: 69.359999999999999,
35: 68.799999999999997,
36: 67.560000000000002,
37: 68.629999999999995,
38: 70.379999999999995,
39: 70.930000000000007,
40: 71.980000000000004,
41: 74.510000000000005,
42: 73.900000000000006,
43: 70.170000000000002,
44: 74.620000000000005,
45: 86.129999999999995,
46: 93.609999999999999,
47: 90.810000000000002,
48: 92.890000000000001,
49: 96.549999999999997,
50: 95.219999999999999,
51: 97.920000000000002,
52: 97.340000000000003,
53: 95.739999999999995,
54: 92.260000000000005,
55: 84.590000000000003,
56: 86.189999999999998,
57: 84.269999999999996,
58: 83.849999999999994,
59: 91.420000000000002,
60: 90.909999999999997,
61: 92.340000000000003,
62: 86.189999999999998,
63: 86.159999999999997,
64: 83.689999999999998,
65: 84.620000000000005,
66: 82.469999999999999,
67: 83.680000000000007,
68: 87.290000000000006,
69: 89.609999999999999,
70: 90.430000000000007,
71: 90.900000000000006,
72: 89.890000000000001,
73: 89.609999999999999,
74: 90.109999999999999,
75: 88.060000000000002,
76: 85.629999999999995,
77: 84.909999999999997,
78: 86.629999999999995,
79: 85.739999999999995,
80: 85.140000000000001,
81: 89.260000000000005,
82: 89.799999999999997,
83: 88.150000000000006,
84: 89.950000000000003,
85: 92.420000000000002,
86: 91.780000000000001,
87: 93.060000000000002,
88: 93.859999999999999,
89: 95.859999999999999,
90: 96.280000000000001,
91: 96.349999999999994,
92: 98.700000000000003,
93: 96.299999999999997,
94: 101.25,
95: 97.150000000000006,
96: 96.659999999999997,
97: 94.180000000000007,
98: 96.829999999999998,
99: 97.430000000000007,
100: 96.670000000000002,
101: 97.590000000000003,
102: 97.569999999999993,
103: 99.890000000000001,
104: 101.84999999999999,
105: 98.549999999999997,
106: 96.859999999999999,
107: 94.049999999999997,
108: 90.269999999999996,
109: 88.469999999999999,
110: 94.530000000000001,
111: 93.950000000000003,
112: 95.069999999999993,
113: 97.709999999999994,
114: 95.849999999999994,
115: 102.88,
116: 105.31999999999999,
117: 102.08,
118: 97.920000000000002,
119: 99.219999999999999,
120: 95.689999999999998,
121: 93.900000000000006,
122: 93.609999999999999,
123: 96.400000000000006,
124: 97.519999999999996,
125: 99.109999999999999,
126: 98.849999999999994,
127: 98.879999999999995,
128: 95.590000000000003,
129: 96.879999999999995,
130: 94.349999999999994,
131: 92.840000000000003,
132: 93.900000000000006,
133: 92.939999999999998,
134: 92.5,
135: 93.409999999999997,
136: 92.859999999999999,
137: 94.310000000000002,
138: 92.510000000000005,
139: 90.579999999999998,
140: 89.900000000000006,
141: 88.810000000000002,
142: 87.409999999999997,
143: 89.219999999999999,
144: 87.709999999999994,
145: 89.560000000000002,
146: 89.930000000000007,
147: 90.349999999999994,
148: 89.209999999999994,
149: 89.400000000000006,
150: 89.540000000000006,
151: 90.620000000000005,
152: 89.700000000000003,
153: 90.129999999999995,
154: 90.159999999999997,
155: 89.930000000000007,
156: 92.549999999999997,
157: 94.189999999999998,
158: 94.519999999999996,
159: 96.780000000000001,
160: 95.930000000000007,
161: 96.519999999999996,
162: 96.879999999999995,
163: 96.370000000000005,
164: 95.629999999999995,
165: 92.409999999999997,
166: 93.390000000000001,
167: 95.599999999999994,
168: 98.950000000000003,
169: 102.01000000000001,
170: 107.8,
171: 111.65000000000001,
172: 109.27,
173: 109.78,
174: 109.62,
175: 109.89,
176: 111.03,
177: 112.98,
178: 114.14,
179: 113.38,
180: 113.90000000000001,
181: 112.90000000000001,
182: 113.79000000000001,
183: 115.53,
184: 114.25,
185: 114.51000000000001,
186: 115.41,
187: 116.45,
188: 119.45999999999999,
189: 119.47,
190: 120.68000000000001,
191: 127.59999999999999,
192: 127.87,
193: 130.27000000000001,
194: 129.47,
195: 132.87,
196: 138.5,
197: 143.86000000000001,
198: 143.81,
199: 139.99000000000001,
200: 145.31999999999999,
201: 146.41,
202: 139.63999999999999,
203: 143.00999999999999,
204: 141.11000000000001,
205: 141.22999999999999,
206: 139.03999999999999,
207: 137.25999999999999,
208: 138.58000000000001,
209: 140.0,
210: 143.21000000000001,
211: 143.78,
212: 144.50999999999999,
213: 144.71000000000001,
214: 148.47999999999999,
215: 151.90000000000001,
216: 150.84999999999999,
217: 146.21000000000001,
218: 146.93000000000001,
219: 145.47999999999999,
220: 147.71000000000001,
221: 145.62,
222: 147.62,
223: 147.97,
224: 146.53,
225: 145.75,
226: 149.28,
227: 150.28999999999999,
228: 150.44,
229: 149.62,
230: 154.80000000000001,
231: 155.84,
232: 156.81,
233: 151.05000000000001,
234: 147.78,
235: 147.90000000000001,
236: 148.31999999999999,
237: 146.59999999999999,
238: 143.74000000000001,
239: 145.66,
240: 149.44999999999999,
241: 148.5,
242: 148.72,
243: 146.03,
244: 145.47999999999999,
245: 145.63999999999999,
246: 142.69999999999999,
247: 141.88,
248: 144.72,
249: 141.86000000000001,
250: 142.68000000000001,
251: 142.41,
252: 139.86000000000001,
253: 139.86000000000001,
254: 136.87,
255: 139.65000000000001,
256: 141.13999999999999,
257: 141.15000000000001,
258: 141.65000000000001,
259: 144.08000000000001,
260: 143.49000000000001,
261: 142.86000000000001,
262: 142.97999999999999,
263: 144.08000000000001,
264: 143.41,
265: 147.28999999999999,
266: 147.55000000000001,
267: 149.40000000000001,
268: 154.72,
269: 155.68000000000001,
270: 151.34999999999999,
271: 151.16,
272: 149.94999999999999,
273: 151.74000000000001,
274: 153.80000000000001,
275: 155.78999999999999,
276: 155.53,
277: 157.52000000000001,
278: 156.97999999999999,
279: 156.81,
280: 152.84999999999999,
281: 154.66,
282: 158.06999999999999,
283: 159.18000000000001,
284: 155.34,
285: 155.19999999999999,
286: 156.22,
287: 156.34,
288: 155.16999999999999,
289: 152.90000000000001,
290: 150.33000000000001,
291: 148.56999999999999,
292: 147.91999999999999,
293: 152.34999999999999,
294: 151.49000000000001,
295: 154.19999999999999,
296: 151.44999999999999,
297: 169.78,
298: 174.15000000000001,
299: 173.28,
300: 177.53999999999999,
301: 176.34999999999999,
302: 178.91,
303: 185.88,
304: 189.5,
305: 189.65000000000001,
306: 192.78,
307: 195.02000000000001,
308: 197.31999999999999,
309: 194.75999999999999,
310: 189.38999999999999,
311: 195.34999999999999,
312: 195.0,
313: 198.28999999999999,
314: 196.19999999999999,
315: 198.88,
316: 201.52000000000001,
317: 199.90000000000001,
318: 204.47999999999999,
319: 208.03,
320: 211.22,
321: 214.09999999999999,
322: 211.53,
323: 201.56999999999999,
324: 202.25,
325: 206.84,
326: 208.63999999999999,
327: 202.72,
328: 202.06999999999999,
329: 201.91,
330: 205.12,
331: 204.40000000000001,
332: 206.09999999999999,
333: 208.53999999999999,
334: 209.27000000000001,
335: 211.05000000000001,
336: 214.86000000000001,
337: 212.09,
338: 214.66,
339: 212.94999999999999,
340: 215.80000000000001,
341: 215.25,
342: 212.11000000000001,
343: 213.13,
344: 209.86000000000001,
345: 207.22,
346: 217.40000000000001,
347: 222.40000000000001,
348: 225.38999999999999,
349: 232.59999999999999,
350: 233.22,
351: 234.65000000000001,
352: 235.58000000000001,
353: 231.58000000000001,
354: 232.88999999999999,
355: 233.31999999999999,
356: 222.22999999999999,
357: 218.0,
358: 199.53,
359: 213.53999999999999,
360: 221.28999999999999,
361: 216.28,
362: 216.91999999999999,
363: 216.53,
364: 213.19999999999999,
365: 216.11000000000001,
366: 200.69,
367: 197.81999999999999,
368: 190.59,
369: 192.36000000000001,
370: 183.78,
371: 184.36000000000001,
372: 179.21000000000001,
373: 181.12,
374: 172.68000000000001,
375: 171.49000000000001,
376: 171.02000000000001,
377: 183.05000000000001,
378: 184.19,
379: 183.11000000000001,
380: 182.56,
381: 188.84999999999999,
382: 188.50999999999999,
383: 194.99000000000001,
384: 181.13,
385: 182.22,
386: 188.03999999999999,
387: 188.90000000000001,
388: 183.87,
389: 182.03999999999999,
390: 176.75999999999999,
391: 171.33000000000001,
392: 168.58000000000001,
393: 168.36000000000001,
394: 175.40000000000001,
395: 172.08000000000001,
396: 169.22,
397: 169.72999999999999,
398: 173.91999999999999,
399: 169.78999999999999,
400: 169.94,
401: 170.77000000000001,
402: 182.72,
403: 184.66,
404: 188.41,
405: 197.28999999999999,
406: 194.03,
407: 194.80000000000001,
408: 194.66,
409: 201.97,
410: 203.78999999999999,
411: 205.38,
412: 202.88,
413: 207.97999999999999,
414: 204.63,
415: 204.27000000000001,
416: 200.88,
417: 203.21000000000001,
418: 201.91999999999999,
419: 205.03999999999999,
420: 207.28999999999999,
421: 218.33000000000001,
422: 220.03,
423: 213.37,
424: 212.77000000000001,
425: 209.80000000000001,
426: 208.75999999999999,
427: 199.25,
428: 197.19999999999999,
429: 196.88999999999999,
430: 197.18000000000001,
431: 196.94999999999999,
432: 197.19,
433: 204.19999999999999,
434: 201.28999999999999,
435: 193.31,
436: 186.88,
437: 187.91,
438: 185.46000000000001,
439: 187.06,
440: 185.31,
441: 184.81999999999999,
442: 185.28999999999999,
443: 187.59999999999999,
444: 190.43000000000001,
445: 191.30000000000001,
446: 190.47999999999999,
447: 185.78,
448: 185.72,
449: 191.12,
450: 189.53,
451: 187.03,
452: 194.80000000000001,
453: 193.06,
454: 196.44999999999999,
455: 193.09,
456: 190.58000000000001,
457: 193.06999999999999,
458: 192.0,
459: 195.30000000000001,
460: 195.15000000000001,
461: 193.88,
462: 193.38999999999999,
463: 200.86000000000001,
464: 199.78,
465: 202.22999999999999,
466: 201.91,
467: 200.96000000000001,
468: 202.84999999999999,
469: 208.69999999999999,
470: 209.46000000000001,
471: 211.38999999999999,
472: 210.52000000000001,
473: 211.38,
474: 210.00999999999999,
475: 208.88999999999999,
476: 212.06999999999999,
477: 208.41999999999999,
478: 204.21000000000001,
479: 201.55000000000001,
480: 203.74000000000001,
481: 201.31999999999999,
482: 199.30000000000001,
483: 193.37,
484: 194.86000000000001,
485: 195.25,
486: 194.49000000000001,
487: 192.56,
488: 191.00999999999999,
489: 193.87,
490: 193.11000000000001,
491: 187.56999999999999,
492: 183.43000000000001,
493: 187.50999999999999,
494: 186.74000000000001,
495: 188.78999999999999,
496: 190.31,
497: 188.28,
498: 186.91,
499: 184.06999999999999,
500: 184.53,
501: 190.28999999999999,
502: 193.66999999999999,
503: 192.71000000000001,
504: 191.49000000000001,
505: 188.46000000000001,
506: 188.96000000000001,
507: 186.53,
508: 186.68000000000001,
509: 186.44,
510: 190.28,
511: 189.28999999999999,
512: 190.18000000000001,
513: 189.08000000000001,
514: 189.11000000000001,
515: 191.99000000000001,
516: 189.88,
517: 189.06,
518: 188.74000000000001,
519: 191.84999999999999,
520: 195.75,
521: 203.08000000000001,
522: 201.78999999999999,
523: 204.74000000000001,
524: 207.13999999999999,
525: 201.69999999999999,
526: 198.30000000000001,
527: 203.22,
528: 201.69,
529: 201.78999999999999,
530: 203.22999999999999,
531: 201.25999999999999,
532: 201.59,
533: 200.75,
534: 200.52000000000001,
535: 201.81999999999999,
536: 207.63999999999999,
537: 205.69999999999999,
538: 210.03999999999999,
539: 214.28999999999999,
540: 213.11000000000001,
541: 213.03999999999999,
542: 213.50999999999999,
543: 213.44,
544: 210.66,
545: 210.11000000000001,
546: 209.44,
547: 212.81999999999999,
548: 229.61000000000001,
549: 240.15000000000001,
550: 236.41999999999999,
551: 243.06,
552: 242.31,
553: 237.36000000000001,
554: 238.05000000000001,
555: 237.96000000000001,
556: 233.52000000000001,
557: 234.72,
558: 235.66,
559: 238.24000000000001,
560: 236.05000000000001,
561: 237.25999999999999,
562: 236.08000000000001,
563: 236.53999999999999,
564: 240.27000000000001,
565: 244.41,
566: 245.72,
567: 247.69999999999999,
568: 249.15000000000001,
569: 247.28,
570: 254.56999999999999,
571: 253.75,
572: 252.19999999999999,
573: 242.13,
574: 244.50999999999999,
575: 242.08000000000001,
576: 242.16,
577: 240.16,
578: 242.18000000000001,
579: 243.25999999999999,
580: 244.11000000000001,
581: 241.08000000000001,
582: 241.81,
583: 241.72,
584: 240.65000000000001,
585: 239.25999999999999,
586: 240.81999999999999,
587: 239.91,
588: 231.16999999999999,
589: 234.08000000000001,
590: 231.22,
591: 227.87,
592: 227.56,
593: 228.53999999999999,
594: 233.78,
595: 231.05000000000001,
596: 230.00999999999999,
597: 233.56,
598: 241.38999999999999,
599: 243.34999999999999,
600: 241.55000000000001,
601: 242.50999999999999,
602: 244.49000000000001,
603: 249.61000000000001,
604: 252.25,
605: 251.88999999999999,
606: 248.38999999999999,
607: 243.66999999999999,
608: 244.63,
609: 240.18000000000001,
610: 239.28999999999999,
611: 249.28,
612: 243.80000000000001,
613: 247.66999999999999,
614: 245.99000000000001,
615: 246.91,
616: 250.5,
617: 240.63,
618: 240.50999999999999,
619: 233.34999999999999,
620: 235.5,
621: 234.77000000000001,
622: 235.28,
623: 230.71000000000001,
624: 228.91999999999999,
625: 229.31999999999999,
626: 232.72999999999999,
627: 230.5,
628: 234.74000000000001,
629: 235.81,
630: 237.69,
631: 237.69,
632: 235.06999999999999,
633: 232.22999999999999,
634: 224.16,
635: 224.5,
636: 223.88999999999999,
637: 219.12,
638: 220.25,
639: 228.55000000000001,
640: 227.59,
641: 227.13,
642: 226.25,
643: 227.15000000000001,
644: 221.28999999999999,
645: 223.78,
646: 222.87,
647: 220.19999999999999,
648: 223.38999999999999,
649: 222.41999999999999,
650: 228.05000000000001,
651: 230.78999999999999,
652: 230.68000000000001,
653: 232.27000000000001,
654: 231.58000000000001,
655: 230.71000000000001,
656: 230.22999999999999,
657: 228.84999999999999,
658: 229.03999999999999,
659: 236.06,
660: 235.27000000000001,
661: 235.52000000000001,
662: 233.87,
663: 233.02000000000001,
664: 232.03,
665: 233.46000000000001,
666: 232.91,
667: 236.90000000000001,
668: 236.16,
669: 237.77000000000001,
670: 235.59,
671: 241.0,
672: 239.30000000000001,
673: 238.53,
674: 238.75999999999999,
675: 240.34999999999999,
676: 239.27000000000001,
677: 235.44999999999999,
678: 234.27000000000001,
679: 232.66,
680: 236.38,
681: 235.31999999999999,
682: 233.40000000000001,
683: 233.16999999999999,
684: 234.38999999999999,
685: 230.5,
686: 233.13999999999999,
687: 230.66,
688: 228.77000000000001,
689: 236.06999999999999,
690: 235.24000000000001,
691: 234.91999999999999,
692: 235.06,
693: 237.69,
694: 236.75,
695: 236.93000000000001,
696: 241.52000000000001,
697: 243.31,
698: 249.05000000000001,
699: 248.71000000000001,
700: 249.94999999999999,
701: 253.28,
702: 259.16000000000003,
703: 258.87,
704: 257.26999999999998,
705: 257.49000000000001,
706: 255.41,
707: 252.13,
708: 252.37,
709: 251.16999999999999,
710: 252.69,
711: 257.33999999999997,
712: 256.89999999999998,
713: 254.72999999999999,
714: 256.80000000000001,
715: 262.23000000000002,
716: 263.44999999999999,
717: 264.86000000000001,
718: 262.88,
719: 262.24000000000001,
720: 261.08999999999997,
721: 264.92000000000002,
722: 266.89999999999998,
723: 270.54000000000002,
724: 269.43000000000001,
725: 271.00999999999999,
726: 271.39999999999998,
727: 271.95999999999998,
728: 272.38999999999999,
729: 275.80000000000001,
730: 276.22000000000003,
731: 277.22000000000003,
732: 274.48000000000002,
733: 274.01999999999998,
734: 259.80000000000001,
735: 256.0,
736: 256.74000000000001,
737: 254.63,
738: 253.75,
739: 255.69,
740: 257.80000000000001,
741: 254.74000000000001,
742: 256.20999999999998,
743: 255.25,
744: 251.25,
745: 254.74000000000001,
746: 257.75,
747: 262.63,
748: 257.11000000000001,
749: 257.62,
750: 257.49000000000001,
751: 254.05000000000001,
752: 248.53,
753: 245.50999999999999,
754: 249.77000000000001,
755: 248.71000000000001,
756: 253.05000000000001,
757: 256.12,
758: 255.84,
759: 257.24000000000001,
760: 256.37,
761: 252.94999999999999,
762: 256.18000000000001,
763: 255.44,
764: 257.37,
765: 262.31,
766: 263.63999999999999,
767: 261.5,
768: 259.42000000000002,
769: 256.98000000000002,
770: 260.39999999999998,
771: 261.06,
772: 262.13,
773: 264.11000000000001,
774: 262.38999999999999,
775: 267.37,
776: 273.14999999999998,
777: 276.13999999999999,
778: 279.76999999999998,
779: 283.73000000000002,
780: 284.22000000000003,
781: 283.80000000000001,
782: 283.47000000000003,
783: 283.35000000000002,
784: 290.98000000000002,
785: 291.89999999999998,
786: 291.72000000000003,
787: 289.23000000000002,
788: 296.73000000000002,
789: 304.50999999999999,
790: 307.27999999999997,
791: 312.38,
792: 310.69,
793: 318.38,
794: 309.74000000000001,
795: 307.69,
796: 316.42000000000002,
797: 319.49000000000001,
798: 322.02999999999997,
799: 325.05000000000001,
800: 337.55000000000001,
801: 337.56999999999999,
802: 333.92000000000002,
803: 336.95999999999998,
804: 339.27999999999997,
805: 347.04000000000002,
806: 353.14999999999998,
807: 351.25,
808: 355.26999999999998,
809: 362.45999999999998,
810: 370.51999999999998,
811: 366.10000000000002,
812: 346.56999999999999,
813: 331.64999999999998,
814: 315.72000000000003,
815: 329.94,
816: 320.51999999999998,
817: 314.50999999999999,
818: 316.5,
819: 312.61000000000001,
820: 323.94999999999999,
821: 329.93000000000001,
822: 338.00999999999999,
823: 332.69999999999999,
824: 336.44999999999999,
825: 345.77999999999997,
826: 348.14999999999998,
827: 346.14999999999998,
828: 340.42000000000002,
829: 341.74000000000001,
830: 348.91000000000003,
831: 357.26999999999998,
832: 357.07999999999998,
833: 358.85000000000002,
834: 349.25,
835: 349.32999999999998,
836: 346.68000000000001,
837: 344.63999999999999,
838: 334.27999999999997,
839: 336.33999999999997,
840: 338.35000000000002,
841: 344.5,
842: 348.0,
843: 350.00999999999999,
844: 355.06,
845: 350.01999999999998,
846: 350.91000000000003,
847: 345.38999999999999,
848: 342.25,
849: 342.31999999999999,
850: 328.17000000000002,
851: 324.30000000000001,
852: 315.51999999999998,
853: 326.26999999999998,
854: 323.04000000000002,
855: 318.81,
856: 326.57999999999998,
857: 318.50999999999999,
858: 307.67000000000002,
859: 300.08999999999997,
860: 299.81999999999999,
861: 291.88,
862: 274.04000000000002,
863: 286.95999999999998,
864: 282.92000000000002,
865: 277.70999999999998,
866: 274.98000000000002,
867: 273.86000000000001,
868: 281.87,
869: 257.69,
870: 247.47,
871: 253.15000000000001,
872: 250.59999999999999,
873: 252.22,
874: 258.08999999999997,
875: 260.31999999999999,
876: 258.79000000000002,
877: 267.04000000000002,
878: 265.86000000000001,
879: 264.56,
880: 254.22,
881: 254.25,
882: 251.18000000000001,
883: 253.65000000000001,
884: 242.97999999999999,
885: 231.86000000000001,
886: 236.19,
887: 237.46000000000001,
888: 235.34999999999999,
889: 228.28,
890: 222.08000000000001,
891: 223.63,
892: 216.13,
893: 216.46000000000001,
894: 206.59999999999999,
895: 219.69999999999999,
896: 219.87,
897: 221.28,
898: 218.74000000000001,
899: 209.72999999999999,
900: 219.36000000000001,
901: 215.78,
902: 216.56,
903: 230.05000000000001,
904: 225.16,
905: 228.87,
906: 221.81999999999999,
907: 218.81999999999999,
908: 220.00999999999999,
909: 232.62,
910: 232.62,
911: 227.33000000000001,
912: 235.31,
913: 238.16999999999999,
914: 233.66999999999999,
915: 231.86000000000001,
916: 234.30000000000001,
917: 228.5,
918: 225.59999999999999,
919: 223.19999999999999,
920: 227.28999999999999,
921: 224.55000000000001,
922: 269.44,
923: 268.63,
924: 277.22000000000003,
925: 272.97000000000003,
926: 271.25,
927: 271.75999999999999,
928: 275.77999999999997,
929: 278.95999999999998,
930: 286.86000000000001,
931: 296.24000000000001,
932: 290.35000000000002,
933: 297.14999999999998,
934: 292.88999999999999,
935: 289.20999999999998,
936: 291.20999999999998,
937: 286.30000000000001,
938: 292.18000000000001,
939: 291.20999999999998,
940: 287.86000000000001,
941: 290.20999999999998,
942: 289.74000000000001,
943: 288.47000000000003,
944: 289.00999999999999,
945: 274.72000000000003,
946: 274.45999999999998,
947: 272.04000000000002,
948: 280.17000000000002,
949: 283.83999999999997,
950: 291.20999999999998,
951: 292.61000000000001,
952: 287.20999999999998,
953: 283.37,
954: 285.81999999999999,
955: 292.86000000000001,
956: 283.22000000000003,
957: 278.66000000000003,
958: 276.81,
959: 272.32999999999998,
960: 276.19999999999999,
961: 285.47000000000003,
962: 286.12,
963: 284.44999999999999,
964: 280.91000000000003,
965: 279.81999999999999,
966: 272.94,
967: 272.32999999999998,
968: 270.88,
969: 275.22000000000003,
970: 264.14999999999998,
971: 263.76999999999998,
972: 262.94999999999999,
973: 267.10000000000002,
974: 263.25999999999999,
975: 268.23000000000002,
976: 271.68000000000001,
977: 276.99000000000001,
978: 270.5,
979: 270.01999999999998,
980: 266.63,
981: 260.55000000000001,
982: 257.79000000000002,
983: 267.52999999999997,
984: 266.44999999999999,
985: 240.41999999999999,
986: 234.16999999999999,
987: 238.31999999999999,
988: 244.37,
989: 237.56999999999999,
990: 245.74000000000001,
991: 238.31999999999999,
992: 241.31,
993: 241.11000000000001,
994: 236.63999999999999,
995: 233.69999999999999,
996: 231.27000000000001,
997: 239.69,
998: 242.93000000000001,
999: 239.31999999999999,
...}In [64]:
max(pokemon)
min(pokemon)
Out[64]:
'Abomasnow'
In [65]:
max(google)
Out[65]:
782.22000000000003
In [66]:
min(google)
Out[66]:
49.950000000000003
More Series Attributes¶
In [75]:
pokemon = pd.read_csv("pokemon.csv", usecols = ["Pokemon"], squeeze = True)
google = pd.read_csv("google_stock_price.csv", squeeze = True)
In [77]:
pokemon.values
google.values
Out[77]:
array([ 50.12, 54.1 , 54.65, ..., 773.18, 771.61, 782.22])
In [79]:
pokemon.index
google.index
Out[79]:
RangeIndex(start=0, stop=3012, step=1)
In [81]:
pokemon.dtype
google.dtype
Out[81]:
dtype('float64')In [83]:
pokemon.is_unique
google.is_unique
Out[83]:
False
In [85]:
pokemon.ndim
google.ndim
Out[85]:
1
In [87]:
pokemon.shape
google.shape
Out[87]:
(3012,)
In [89]:
pokemon.size
google.size
Out[89]:
3012
In [93]:
pokemon.name = "Pocket Monsters"
In [94]:
pokemon.head()
Out[94]:
0 Bulbasaur 1 Ivysaur 2 Venusaur 3 Charmander 4 Charmeleon Name: Pocket Monsters, dtype: object
The .sort_values() Method¶
In [95]:
pokemon = pd.read_csv("pokemon.csv", usecols = ["Pokemon"], squeeze = True)
google = pd.read_csv("google_stock_price.csv", squeeze = True)
In [97]:
pokemon.sort_values().head()
Out[97]:
459 Abomasnow 62 Abra 358 Absol 616 Accelgor 680 Aegislash Name: Pokemon, dtype: object
In [100]:
pokemon.sort_values(ascending = False).tail()
Out[100]:
680 Aegislash 616 Accelgor 358 Absol 62 Abra 459 Abomasnow Name: Pokemon, dtype: object
In [104]:
google.sort_values(ascending = False).head(1)
Out[104]:
3011 782.22 Name: Stock Price, dtype: float64
In [106]:
google
Out[106]:
0 50.12
1 54.10
2 54.65
3 52.38
4 52.95
5 53.90
6 53.02
7 50.95
8 51.13
9 50.07
10 50.70
11 49.95
12 50.74
13 51.10
14 51.10
15 52.61
16 53.70
17 55.69
18 55.94
19 56.93
20 58.69
21 59.62
22 58.86
23 59.13
24 60.35
25 59.86
26 59.07
27 63.37
28 65.47
29 64.74
...
2982 675.22
2983 668.26
2984 680.04
2985 684.11
2986 692.10
2987 699.21
2988 694.49
2989 697.77
2990 695.36
2991 705.63
2992 715.09
2993 720.64
2994 716.98
2995 720.95
2996 719.85
2997 733.78
2998 736.96
2999 741.19
3000 738.63
3001 742.74
3002 739.77
3003 738.42
3004 741.77
3005 745.91
3006 768.79
3007 772.88
3008 771.07
3009 773.18
3010 771.61
3011 782.22
Name: Stock Price, dtype: float64 The inplace Parameter¶
In [112]:
pokemon = pd.read_csv("pokemon.csv", usecols = ["Pokemon"], squeeze = True)
google = pd.read_csv("google_stock_price.csv", squeeze = True)
In [113]:
google.head(3)
Out[113]:
0 50.12 1 54.10 2 54.65 Name: Stock Price, dtype: float64
In [115]:
google = google.sort_values()
In [118]:
google.head(3)
Out[118]:
11 49.95 9 50.07 0 50.12 Name: Stock Price, dtype: float64
In [119]:
google.sort_values(ascending = False, inplace = True)
In [120]:
google.head(3)
Out[120]:
3011 782.22 2859 776.60 3009 773.18 Name: Stock Price, dtype: float64
The .sort_index() Method¶
In [129]:
pokemon = pd.read_csv("pokemon.csv", usecols = ["Pokemon"], squeeze = True)
google = pd.read_csv("google_stock_price.csv", squeeze = True)
In [133]:
pokemon.sort_values(ascending = False, inplace = True)
In [139]:
pokemon.head(3)
Out[139]:
0 Bulbasaur 1 Ivysaur 2 Venusaur Name: Pokemon, dtype: object
In [138]:
pokemon.sort_index(ascending = True, inplace = True)
Python's in Keyword¶
In [149]:
pokemon = pd.read_csv("pokemon.csv", usecols = ["Pokemon"], squeeze = True)
google = pd.read_csv("google_stock_price.csv", squeeze = True)
In [151]:
100 in [1, 2, 3, 4, 5]
Out[151]:
False
In [152]:
pokemon.head(3)
Out[152]:
0 Bulbasaur 1 Ivysaur 2 Venusaur Name: Pokemon, dtype: object
In [155]:
100 in pokemon
100 in pokemon.index
Out[155]:
True
In [156]:
pokemon.index
Out[156]:
RangeIndex(start=0, stop=721, step=1)
In [161]:
"Digimon" in pokemon.values
Out[161]:
False
Extract Values by Index Position¶
In [162]:
pokemon = pd.read_csv("pokemon.csv", usecols = ["Pokemon"], squeeze = True)
google = pd.read_csv("google_stock_price.csv", squeeze = True)
In [163]:
pokemon.head(3)
Out[163]:
0 Bulbasaur 1 Ivysaur 2 Venusaur Name: Pokemon, dtype: object
In [172]:
pokemon[1]
pokemon[[100, 200, 300]]
pokemon[50:101]
pokemon[:50]
pokemon[-30:]
pokemon[-30 : -10]
Out[172]:
691 Clauncher 692 Clawitzer 693 Helioptile 694 Heliolisk 695 Tyrunt 696 Tyrantrum 697 Amaura 698 Aurorus 699 Sylveon 700 Hawlucha 701 Dedenne 702 Carbink 703 Goomy 704 Sliggoo 705 Goodra 706 Klefki 707 Phantump 708 Trevenant 709 Pumpkaboo 710 Gourgeist Name: Pokemon, dtype: object
Extract Values by Index Label¶
In [176]:
pokemon = pd.read_csv("pokemon.csv", index_col = "Pokemon", squeeze = True)
pokemon.head(3)
Out[176]:
Pokemon Bulbasaur Grass Ivysaur Grass Venusaur Grass Name: Type, dtype: object
In [178]:
pokemon[[100, 134]]
Out[178]:
Pokemon Electrode Electric Jolteon Electric Name: Type, dtype: object
In [185]:
pokemon["Bulbasaur"]
pokemon["Ditto"]
pokemon[["Charizard", "Jolteon"]]
pokemon[["Blastoise", "Venusaur", "Meowth"]]
pokemon[["Pikachu", "Digimon"]]
pokemon["Bulbasaur" : "Pikachu"]
Out[185]:
Pokemon Bulbasaur Grass Ivysaur Grass Venusaur Grass Charmander Fire Charmeleon Fire Charizard Fire Squirtle Water Wartortle Water Blastoise Water Caterpie Bug Metapod Bug Butterfree Bug Weedle Bug Kakuna Bug Beedrill Bug Pidgey Normal Pidgeotto Normal Pidgeot Normal Rattata Normal Raticate Normal Spearow Normal Fearow Normal Ekans Poison Arbok Poison Pikachu Electric Name: Type, dtype: object
The .get() Method on a Series¶
In [192]:
pokemon = pd.read_csv("pokemon.csv", index_col = "Pokemon", squeeze = True)
pokemon.sort_index(inplace = True)
pokemon.head(3)
Out[192]:
Pokemon Abomasnow Grass Abra Psychic Absol Dark Name: Type, dtype: object
In [195]:
pokemon.get(key = ["Moltres", "Meowth"])
Out[195]:
Pokemon Moltres Fire Meowth Normal Name: Type, dtype: object
In [199]:
pokemon.get(key = "Charizard", default = "This is not a Pokemon")
Out[199]:
'Fire'
In [202]:
pokemon.get(key = "jksajk", default = "This is not a Pokemon")
Out[202]:
'This is not a Pokemon'
Math Methods on Series Objects¶
In [219]:
google = pd.read_csv("google_stock_price.csv", squeeze = True)
google.head(3)
Out[219]:
0 50.12 1 54.10 2 54.65 Name: Stock Price, dtype: float64
In [220]:
google.count()
Out[220]:
3012
In [221]:
len(google)
Out[221]:
3012
In [222]:
google.sum()
Out[222]:
1006942.0000000002
In [223]:
google.mean()
Out[223]:
334.31009296148744
In [224]:
google.sum() / google.count()
Out[224]:
334.31009296148744
In [225]:
google.std()
Out[225]:
173.18720477113106
In [226]:
google.min()
Out[226]:
49.950000000000003
In [227]:
google.max()
Out[227]:
782.22000000000003
In [228]:
google.median()
Out[228]:
283.315
In [229]:
google.mode()
Out[229]:
0 291.21 dtype: float64
In [230]:
google.describe()
Out[230]:
count 3012.000000 mean 334.310093 std 173.187205 min 49.950000 25% 218.045000 50% 283.315000 75% 443.000000 max 782.220000 Name: Stock Price, dtype: float64
The .idxmax() and .idxmin() Methods¶
In [232]:
google = pd.read_csv("google_stock_price.csv", squeeze = True)
In [233]:
google.max()
Out[233]:
782.22000000000003
In [234]:
google.min()
Out[234]:
49.950000000000003
In [235]:
google.idxmax()
Out[235]:
3011
In [236]:
google[3011]
Out[236]:
782.22000000000003
In [237]:
google.idxmin()
Out[237]:
11
In [238]:
google[11]
Out[238]:
49.950000000000003
In [239]:
google[google.idxmin()]
Out[239]:
49.950000000000003
The .value_counts() Method¶
In [240]:
pokemon = pd.read_csv("pokemon.csv", index_col = "Pokemon", squeeze = True)
pokemon.head(3)
Out[240]:
Pokemon Bulbasaur Grass Ivysaur Grass Venusaur Grass Name: Type, dtype: object
In [242]:
pokemon.value_counts().sum()
Out[242]:
721
In [243]:
pokemon.count()
Out[243]:
721
In [246]:
pokemon.value_counts(ascending = True)
Out[246]:
Flying 3 Fairy 17 Steel 22 Ice 23 Ghost 23 Dragon 24 Fighting 25 Dark 28 Poison 28 Ground 30 Electric 36 Rock 41 Psychic 47 Fire 47 Bug 63 Grass 66 Normal 93 Water 105 Name: Type, dtype: int64
The .apply() Method¶
In [255]:
google = pd.read_csv("google_stock_price.csv", squeeze = True)
google.head(6)
Out[255]:
0 50.12 1 54.10 2 54.65 3 52.38 4 52.95 5 53.90 Name: Stock Price, dtype: float64
In [256]:
def classify_performance(number):
if number < 300:
return "OK"
elif number >= 300 and number < 650:
return "Satisfactory"
else:
return "Incredible!"
In [258]:
google.apply(classify_performance).tail()
Out[258]:
3007 Incredible! 3008 Incredible! 3009 Incredible! 3010 Incredible! 3011 Incredible! Name: Stock Price, dtype: object
In [259]:
google.head(6)
Out[259]:
0 50.12 1 54.10 2 54.65 3 52.38 4 52.95 5 53.90 Name: Stock Price, dtype: float64
In [260]:
google.apply(lambda stock_price : stock_price + 1)
Out[260]:
0 51.12
1 55.10
2 55.65
3 53.38
4 53.95
5 54.90
6 54.02
7 51.95
8 52.13
9 51.07
10 51.70
11 50.95
12 51.74
13 52.10
14 52.10
15 53.61
16 54.70
17 56.69
18 56.94
19 57.93
20 59.69
21 60.62
22 59.86
23 60.13
24 61.35
25 60.86
26 60.07
27 64.37
28 66.47
29 65.74
...
2982 676.22
2983 669.26
2984 681.04
2985 685.11
2986 693.10
2987 700.21
2988 695.49
2989 698.77
2990 696.36
2991 706.63
2992 716.09
2993 721.64
2994 717.98
2995 721.95
2996 720.85
2997 734.78
2998 737.96
2999 742.19
3000 739.63
3001 743.74
3002 740.77
3003 739.42
3004 742.77
3005 746.91
3006 769.79
3007 773.88
3008 772.07
3009 774.18
3010 772.61
3011 783.22
Name: Stock Price, dtype: float64 The .map() Method¶
In [261]:
pokemon_names = pd.read_csv("pokemon.csv", usecols = ["Pokemon"], squeeze = True)
pokemon_names.head(3)
Out[261]:
0 Bulbasaur 1 Ivysaur 2 Venusaur Name: Pokemon, dtype: object
In [262]:
pokemon_types = pd.read_csv("pokemon.csv", index_col = "Pokemon", squeeze = True)
pokemon_types.head(3)
Out[262]:
Pokemon Bulbasaur Grass Ivysaur Grass Venusaur Grass Name: Type, dtype: object
In [263]:
pokemon_names.map(pokemon_types)
Out[263]:
0 Grass
1 Grass
2 Grass
3 Fire
4 Fire
5 Fire
6 Water
7 Water
8 Water
9 Bug
10 Bug
11 Bug
12 Bug
13 Bug
14 Bug
15 Normal
16 Normal
17 Normal
18 Normal
19 Normal
20 Normal
21 Normal
22 Poison
23 Poison
24 Electric
25 Electric
26 Ground
27 Ground
28 Poison
29 Poison
...
691 Water
692 Water
693 Electric
694 Electric
695 Rock
696 Rock
697 Rock
698 Rock
699 Fairy
700 Fighting
701 Electric
702 Rock
703 Dragon
704 Dragon
705 Dragon
706 Steel
707 Ghost
708 Ghost
709 Ghost
710 Ghost
711 Ice
712 Ice
713 Flying
714 Flying
715 Fairy
716 Dark
717 Dragon
718 Rock
719 Psychic
720 Fire
Name: Pokemon, dtype: objectIn [264]:
pokemon_names = pd.read_csv("pokemon.csv", usecols = ["Pokemon"], squeeze = True)
pokemon_types = pd.read_csv("pokemon.csv", index_col = "Pokemon", squeeze = True).to_dict()
In [265]:
pokemon_names.head()
Out[265]:
0 Bulbasaur 1 Ivysaur 2 Venusaur 3 Charmander 4 Charmeleon Name: Pokemon, dtype: object
In [266]:
pokemon_types
Out[266]:
{'Abomasnow': 'Grass',
'Abra': 'Psychic',
'Absol': 'Dark',
'Accelgor': 'Bug',
'Aegislash': 'Steel',
'Aerodactyl': 'Rock',
'Aggron': 'Steel',
'Aipom': 'Normal',
'Alakazam': 'Psychic',
'Alomomola': 'Water',
'Altaria': 'Dragon',
'Amaura': 'Rock',
'Ambipom': 'Normal',
'Amoonguss': 'Grass',
'Ampharos': 'Electric',
'Anorith': 'Rock',
'Arbok': 'Poison',
'Arcanine': 'Fire',
'Arceus': 'Normal',
'Archen': 'Rock',
'Archeops': 'Rock',
'Ariados': 'Bug',
'Armaldo': 'Rock',
'Aromatisse': 'Fairy',
'Aron': 'Steel',
'Articuno': 'Ice',
'Audino': 'Normal',
'Aurorus': 'Rock',
'Avalugg': 'Ice',
'Axew': 'Dragon',
'Azelf': 'Psychic',
'Azumarill': 'Water',
'Azurill': 'Normal',
'Bagon': 'Dragon',
'Baltoy': 'Ground',
'Banette': 'Ghost',
'Barbaracle': 'Rock',
'Barboach': 'Water',
'Basculin': 'Water',
'Bastiodon': 'Rock',
'Bayleef': 'Grass',
'Beartic': 'Ice',
'Beautifly': 'Bug',
'Beedrill': 'Bug',
'Beheeyem': 'Psychic',
'Beldum': 'Steel',
'Bellossom': 'Grass',
'Bellsprout': 'Grass',
'Bergmite': 'Ice',
'Bibarel': 'Normal',
'Bidoof': 'Normal',
'Binacle': 'Rock',
'Bisharp': 'Dark',
'Blastoise': 'Water',
'Blaziken': 'Fire',
'Blissey': 'Normal',
'Blitzle': 'Electric',
'Boldore': 'Rock',
'Bonsly': 'Rock',
'Bouffalant': 'Normal',
'Braixen': 'Fire',
'Braviary': 'Normal',
'Breloom': 'Grass',
'Bronzong': 'Steel',
'Bronzor': 'Steel',
'Budew': 'Grass',
'Buizel': 'Water',
'Bulbasaur': 'Grass',
'Buneary': 'Normal',
'Bunnelby': 'Normal',
'Burmy': 'Bug',
'Butterfree': 'Bug',
'Cacnea': 'Grass',
'Cacturne': 'Grass',
'Camerupt': 'Fire',
'Carbink': 'Rock',
'Carnivine': 'Grass',
'Carracosta': 'Water',
'Carvanha': 'Water',
'Cascoon': 'Bug',
'Castform': 'Normal',
'Caterpie': 'Bug',
'Celebi': 'Psychic',
'Chandelure': 'Ghost',
'Chansey': 'Normal',
'Charizard': 'Fire',
'Charmander': 'Fire',
'Charmeleon': 'Fire',
'Chatot': 'Normal',
'Cherrim': 'Grass',
'Cherubi': 'Grass',
'Chesnaught': 'Grass',
'Chespin': 'Grass',
'Chikorita': 'Grass',
'Chimchar': 'Fire',
'Chimecho': 'Psychic',
'Chinchou': 'Water',
'Chingling': 'Psychic',
'Cinccino': 'Normal',
'Clamperl': 'Water',
'Clauncher': 'Water',
'Clawitzer': 'Water',
'Claydol': 'Ground',
'Clefable': 'Fairy',
'Clefairy': 'Fairy',
'Cleffa': 'Fairy',
'Cloyster': 'Water',
'Cobalion': 'Steel',
'Cofagrigus': 'Ghost',
'Combee': 'Bug',
'Combusken': 'Fire',
'Conkeldurr': 'Fighting',
'Corphish': 'Water',
'Corsola': 'Water',
'Cottonee': 'Grass',
'Cradily': 'Rock',
'Cranidos': 'Rock',
'Crawdaunt': 'Water',
'Cresselia': 'Psychic',
'Croagunk': 'Poison',
'Crobat': 'Poison',
'Croconaw': 'Water',
'Crustle': 'Bug',
'Cryogonal': 'Ice',
'Cubchoo': 'Ice',
'Cubone': 'Ground',
'Cyndaquil': 'Fire',
'Darkrai': 'Dark',
'Darmanitan': 'Fire',
'Darumaka': 'Fire',
'Dedenne': 'Electric',
'Deerling': 'Normal',
'Deino': 'Dark',
'Delcatty': 'Normal',
'Delibird': 'Ice',
'Delphox': 'Fire',
'Deoxys': 'Psychic',
'Dewgong': 'Water',
'Dewott': 'Water',
'Dialga': 'Steel',
'Diancie': 'Rock',
'Diggersby': 'Normal',
'Diglett': 'Ground',
'Ditto': 'Normal',
'Dodrio': 'Normal',
'Doduo': 'Normal',
'Donphan': 'Ground',
'Doublade': 'Steel',
'Dragalge': 'Poison',
'Dragonair': 'Dragon',
'Dragonite': 'Dragon',
'Drapion': 'Poison',
'Dratini': 'Dragon',
'Drifblim': 'Ghost',
'Drifloon': 'Ghost',
'Drilbur': 'Ground',
'Drowzee': 'Psychic',
'Druddigon': 'Dragon',
'Ducklett': 'Water',
'Dugtrio': 'Ground',
'Dunsparce': 'Normal',
'Duosion': 'Psychic',
'Durant': 'Bug',
'Dusclops': 'Ghost',
'Dusknoir': 'Ghost',
'Duskull': 'Ghost',
'Dustox': 'Bug',
'Dwebble': 'Bug',
'Eelektrik': 'Electric',
'Eelektross': 'Electric',
'Eevee': 'Normal',
'Ekans': 'Poison',
'Electabuzz': 'Electric',
'Electivire': 'Electric',
'Electrike': 'Electric',
'Electrode': 'Electric',
'Elekid': 'Electric',
'Elgyem': 'Psychic',
'Emboar': 'Fire',
'Emolga': 'Electric',
'Empoleon': 'Water',
'Entei': 'Fire',
'Escavalier': 'Bug',
'Espeon': 'Psychic',
'Espurr': 'Psychic',
'Excadrill': 'Ground',
'Exeggcute': 'Grass',
'Exeggutor': 'Grass',
'Exploud': 'Normal',
"Farfetch'd": 'Normal',
'Fearow': 'Normal',
'Feebas': 'Water',
'Fennekin': 'Fire',
'Feraligatr': 'Water',
'Ferroseed': 'Grass',
'Ferrothorn': 'Grass',
'Finneon': 'Water',
'Flaaffy': 'Electric',
'Flabébé': 'Fairy',
'Flareon': 'Fire',
'Fletchinder': 'Fire',
'Fletchling': 'Normal',
'Floatzel': 'Water',
'Floette': 'Fairy',
'Florges': 'Fairy',
'Flygon': 'Ground',
'Foongus': 'Grass',
'Forretress': 'Bug',
'Fraxure': 'Dragon',
'Frillish': 'Water',
'Froakie': 'Water',
'Frogadier': 'Water',
'Froslass': 'Ice',
'Furfrou': 'Normal',
'Furret': 'Normal',
'Gabite': 'Dragon',
'Gallade': 'Psychic',
'Galvantula': 'Bug',
'Garbodor': 'Poison',
'Garchomp': 'Dragon',
'Gardevoir': 'Psychic',
'Gastly': 'Ghost',
'Gastrodon': 'Water',
'Genesect': 'Bug',
'Gengar': 'Ghost',
'Geodude': 'Rock',
'Gible': 'Dragon',
'Gigalith': 'Rock',
'Girafarig': 'Normal',
'Giratina': 'Ghost',
'Glaceon': 'Ice',
'Glalie': 'Ice',
'Glameow': 'Normal',
'Gligar': 'Ground',
'Gliscor': 'Ground',
'Gloom': 'Grass',
'Gogoat': 'Grass',
'Golbat': 'Poison',
'Goldeen': 'Water',
'Golduck': 'Water',
'Golem': 'Rock',
'Golett': 'Ground',
'Golurk': 'Ground',
'Goodra': 'Dragon',
'Goomy': 'Dragon',
'Gorebyss': 'Water',
'Gothita': 'Psychic',
'Gothitelle': 'Psychic',
'Gothorita': 'Psychic',
'Gourgeist': 'Ghost',
'Granbull': 'Fairy',
'Graveler': 'Rock',
'Greninja': 'Water',
'Grimer': 'Poison',
'Grotle': 'Grass',
'Groudon': 'Ground',
'Grovyle': 'Grass',
'Growlithe': 'Fire',
'Grumpig': 'Psychic',
'Gulpin': 'Poison',
'Gurdurr': 'Fighting',
'Gyarados': 'Water',
'Happiny': 'Normal',
'Hariyama': 'Fighting',
'Haunter': 'Ghost',
'Hawlucha': 'Fighting',
'Haxorus': 'Dragon',
'Heatmor': 'Fire',
'Heatran': 'Fire',
'Heliolisk': 'Electric',
'Helioptile': 'Electric',
'Heracross': 'Bug',
'Herdier': 'Normal',
'Hippopotas': 'Ground',
'Hippowdon': 'Ground',
'Hitmonchan': 'Fighting',
'Hitmonlee': 'Fighting',
'Hitmontop': 'Fighting',
'Ho-oh': 'Fire',
'Honchkrow': 'Dark',
'Honedge': 'Steel',
'Hoopa': 'Psychic',
'Hoothoot': 'Normal',
'Hoppip': 'Grass',
'Horsea': 'Water',
'Houndoom': 'Dark',
'Houndour': 'Dark',
'Huntail': 'Water',
'Hydreigon': 'Dark',
'Hypno': 'Psychic',
'Igglybuff': 'Normal',
'Illumise': 'Bug',
'Infernape': 'Fire',
'Inkay': 'Dark',
'Ivysaur': 'Grass',
'Jellicent': 'Water',
'Jigglypuff': 'Normal',
'Jirachi': 'Steel',
'Jolteon': 'Electric',
'Joltik': 'Bug',
'Jumpluff': 'Grass',
'Jynx': 'Ice',
'Kabuto': 'Rock',
'Kabutops': 'Rock',
'Kadabra': 'Psychic',
'Kakuna': 'Bug',
'Kangaskhan': 'Normal',
'Karrablast': 'Bug',
'Kecleon': 'Normal',
'Keldeo': 'Water',
'Kingdra': 'Water',
'Kingler': 'Water',
'Kirlia': 'Psychic',
'Klang': 'Steel',
'Klefki': 'Steel',
'Klink': 'Steel',
'Klinklang': 'Steel',
'Koffing': 'Poison',
'Krabby': 'Water',
'Kricketot': 'Bug',
'Kricketune': 'Bug',
'Krokorok': 'Ground',
'Krookodile': 'Ground',
'Kyogre': 'Water',
'Kyurem': 'Dragon',
'Lairon': 'Steel',
'Lampent': 'Ghost',
'Landorus': 'Ground',
'Lanturn': 'Water',
'Lapras': 'Water',
'Larvesta': 'Bug',
'Larvitar': 'Rock',
'Latias': 'Dragon',
'Latios': 'Dragon',
'Leafeon': 'Grass',
'Leavanny': 'Bug',
'Ledian': 'Bug',
'Ledyba': 'Bug',
'Lickilicky': 'Normal',
'Lickitung': 'Normal',
'Liepard': 'Dark',
'Lileep': 'Rock',
'Lilligant': 'Grass',
'Lillipup': 'Normal',
'Linoone': 'Normal',
'Litleo': 'Fire',
'Litwick': 'Ghost',
'Lombre': 'Water',
'Lopunny': 'Normal',
'Lotad': 'Water',
'Loudred': 'Normal',
'Lucario': 'Fighting',
'Ludicolo': 'Water',
'Lugia': 'Psychic',
'Lumineon': 'Water',
'Lunatone': 'Rock',
'Luvdisc': 'Water',
'Luxio': 'Electric',
'Luxray': 'Electric',
'Machamp': 'Fighting',
'Machoke': 'Fighting',
'Machop': 'Fighting',
'Magby': 'Fire',
'Magcargo': 'Fire',
'Magikarp': 'Water',
'Magmar': 'Fire',
'Magmortar': 'Fire',
'Magnemite': 'Electric',
'Magneton': 'Electric',
'Magnezone': 'Electric',
'Makuhita': 'Fighting',
'Malamar': 'Dark',
'Mamoswine': 'Ice',
'Manaphy': 'Water',
'Mandibuzz': 'Dark',
'Manectric': 'Electric',
'Mankey': 'Fighting',
'Mantine': 'Water',
'Mantyke': 'Water',
'Maractus': 'Grass',
'Mareep': 'Electric',
'Marill': 'Water',
'Marowak': 'Ground',
'Marshtomp': 'Water',
'Masquerain': 'Bug',
'Mawile': 'Steel',
'Medicham': 'Fighting',
'Meditite': 'Fighting',
'Meganium': 'Grass',
'Meloetta': 'Normal',
'Meowstic': 'Psychic',
'Meowth': 'Normal',
'Mesprit': 'Psychic',
'Metagross': 'Steel',
'Metang': 'Steel',
'Metapod': 'Bug',
'Mew': 'Psychic',
'Mewtwo': 'Psychic',
'Mienfoo': 'Fighting',
'Mienshao': 'Fighting',
'Mightyena': 'Dark',
'Milotic': 'Water',
'Miltank': 'Normal',
'Mime Jr.': 'Psychic',
'Minccino': 'Normal',
'Minun': 'Electric',
'Misdreavus': 'Ghost',
'Mismagius': 'Ghost',
'Moltres': 'Fire',
'Monferno': 'Fire',
'Mothim': 'Bug',
'Mr. Mime': 'Psychic',
'Mudkip': 'Water',
'Muk': 'Poison',
'Munchlax': 'Normal',
'Munna': 'Psychic',
'Murkrow': 'Dark',
'Musharna': 'Psychic',
'Natu': 'Psychic',
'Nidoking': 'Poison',
'Nidoqueen': 'Poison',
'Nidoran': 'Poison',
'Nidoran♂': 'Poison',
'Nidorina': 'Poison',
'Nidorino': 'Poison',
'Nincada': 'Bug',
'Ninetales': 'Fire',
'Ninjask': 'Bug',
'Noctowl': 'Normal',
'Noibat': 'Flying',
'Noivern': 'Flying',
'Nosepass': 'Rock',
'Numel': 'Fire',
'Nuzleaf': 'Grass',
'Octillery': 'Water',
'Oddish': 'Grass',
'Omanyte': 'Rock',
'Omastar': 'Rock',
'Onix': 'Rock',
'Oshawott': 'Water',
'Pachirisu': 'Electric',
'Palkia': 'Water',
'Palpitoad': 'Water',
'Pancham': 'Fighting',
'Pangoro': 'Fighting',
'Panpour': 'Water',
'Pansage': 'Grass',
'Pansear': 'Fire',
'Paras': 'Bug',
'Parasect': 'Bug',
'Patrat': 'Normal',
'Pawniard': 'Dark',
'Pelipper': 'Water',
'Persian': 'Normal',
'Petilil': 'Grass',
'Phanpy': 'Ground',
'Phantump': 'Ghost',
'Phione': 'Water',
'Pichu': 'Electric',
'Pidgeot': 'Normal',
'Pidgeotto': 'Normal',
'Pidgey': 'Normal',
'Pidove': 'Normal',
'Pignite': 'Fire',
'Pikachu': 'Electric',
'Piloswine': 'Ice',
'Pineco': 'Bug',
'Pinsir': 'Bug',
'Piplup': 'Water',
'Plusle': 'Electric',
'Politoed': 'Water',
'Poliwag': 'Water',
'Poliwhirl': 'Water',
'Poliwrath': 'Water',
'Ponyta': 'Fire',
'Poochyena': 'Dark',
'Porygon': 'Normal',
'Porygon-Z': 'Normal',
'Porygon2': 'Normal',
'Primeape': 'Fighting',
'Prinplup': 'Water',
'Probopass': 'Rock',
'Psyduck': 'Water',
'Pumpkaboo': 'Ghost',
'Pupitar': 'Rock',
'Purrloin': 'Dark',
'Purugly': 'Normal',
'Pyroar': 'Fire',
'Quagsire': 'Water',
'Quilava': 'Fire',
'Quilladin': 'Grass',
'Qwilfish': 'Water',
'Raichu': 'Electric',
'Raikou': 'Electric',
'Ralts': 'Psychic',
'Rampardos': 'Rock',
'Rapidash': 'Fire',
'Raticate': 'Normal',
'Rattata': 'Normal',
'Rayquaza': 'Dragon',
'Regice': 'Ice',
'Regigigas': 'Normal',
'Regirock': 'Rock',
'Registeel': 'Steel',
'Relicanth': 'Water',
'Remoraid': 'Water',
'Reshiram': 'Dragon',
'Reuniclus': 'Psychic',
'Rhydon': 'Ground',
'Rhyhorn': 'Ground',
'Rhyperior': 'Ground',
'Riolu': 'Fighting',
'Roggenrola': 'Rock',
'Roselia': 'Grass',
'Roserade': 'Grass',
'Rotom': 'Electric',
'Rufflet': 'Normal',
'Sableye': 'Dark',
'Salamence': 'Dragon',
'Samurott': 'Water',
'Sandile': 'Ground',
'Sandshrew': 'Ground',
'Sandslash': 'Ground',
'Sawk': 'Fighting',
'Sawsbuck': 'Normal',
'Scatterbug': 'Bug',
'Sceptile': 'Grass',
'Scizor': 'Bug',
'Scolipede': 'Bug',
'Scrafty': 'Dark',
'Scraggy': 'Dark',
'Scyther': 'Bug',
'Seadra': 'Water',
'Seaking': 'Water',
'Sealeo': 'Ice',
'Seedot': 'Grass',
'Seel': 'Water',
'Seismitoad': 'Water',
'Sentret': 'Normal',
'Serperior': 'Grass',
'Servine': 'Grass',
'Seviper': 'Poison',
'Sewaddle': 'Bug',
'Sharpedo': 'Water',
'Shaymin': 'Grass',
'Shedinja': 'Bug',
'Shelgon': 'Dragon',
'Shellder': 'Water',
'Shellos': 'Water',
'Shelmet': 'Bug',
'Shieldon': 'Rock',
'Shiftry': 'Grass',
'Shinx': 'Electric',
'Shroomish': 'Grass',
'Shuckle': 'Bug',
'Shuppet': 'Ghost',
'Sigilyph': 'Psychic',
'Silcoon': 'Bug',
'Simipour': 'Water',
'Simisage': 'Grass',
'Simisear': 'Fire',
'Skarmory': 'Steel',
'Skiddo': 'Grass',
'Skiploom': 'Grass',
'Skitty': 'Normal',
'Skorupi': 'Poison',
'Skrelp': 'Poison',
'Skuntank': 'Poison',
'Slaking': 'Normal',
'Slakoth': 'Normal',
'Sliggoo': 'Dragon',
'Slowbro': 'Water',
'Slowking': 'Water',
'Slowpoke': 'Water',
'Slugma': 'Fire',
'Slurpuff': 'Fairy',
'Smeargle': 'Normal',
'Smoochum': 'Ice',
'Sneasel': 'Dark',
'Snivy': 'Grass',
'Snorlax': 'Normal',
'Snorunt': 'Ice',
'Snover': 'Grass',
'Snubbull': 'Fairy',
'Solosis': 'Psychic',
'Solrock': 'Rock',
'Spearow': 'Normal',
'Spewpa': 'Bug',
'Spheal': 'Ice',
'Spinarak': 'Bug',
'Spinda': 'Normal',
'Spiritomb': 'Ghost',
'Spoink': 'Psychic',
'Spritzee': 'Fairy',
'Squirtle': 'Water',
'Stantler': 'Normal',
'Staraptor': 'Normal',
'Staravia': 'Normal',
'Starly': 'Normal',
'Starmie': 'Water',
'Staryu': 'Water',
'Steelix': 'Steel',
'Stoutland': 'Normal',
'Stunfisk': 'Ground',
'Stunky': 'Poison',
'Sudowoodo': 'Rock',
'Suicune': 'Water',
'Sunflora': 'Grass',
'Sunkern': 'Grass',
'Surskit': 'Bug',
'Swablu': 'Normal',
'Swadloon': 'Bug',
'Swalot': 'Poison',
'Swampert': 'Water',
'Swanna': 'Water',
'Swellow': 'Normal',
'Swinub': 'Ice',
'Swirlix': 'Fairy',
'Swoobat': 'Psychic',
'Sylveon': 'Fairy',
'Taillow': 'Normal',
'Talonflame': 'Fire',
'Tangela': 'Grass',
'Tangrowth': 'Grass',
'Tauros': 'Normal',
'Teddiursa': 'Normal',
'Tentacool': 'Water',
'Tentacruel': 'Water',
'Tepig': 'Fire',
'Terrakion': 'Rock',
'Throh': 'Fighting',
'Thundurus': 'Electric',
'Timburr': 'Fighting',
'Tirtouga': 'Water',
'Togekiss': 'Fairy',
'Togepi': 'Fairy',
'Togetic': 'Fairy',
'Torchic': 'Fire',
'Torkoal': 'Fire',
'Tornadus': 'Flying',
'Torterra': 'Grass',
'Totodile': 'Water',
'Toxicroak': 'Poison',
'Tranquill': 'Normal',
'Trapinch': 'Ground',
'Treecko': 'Grass',
'Trevenant': 'Ghost',
'Tropius': 'Grass',
'Trubbish': 'Poison',
'Turtwig': 'Grass',
'Tympole': 'Water',
'Tynamo': 'Electric',
'Typhlosion': 'Fire',
'Tyranitar': 'Rock',
'Tyrantrum': 'Rock',
'Tyrogue': 'Fighting',
'Tyrunt': 'Rock',
'Umbreon': 'Dark',
'Unfezant': 'Normal',
'Unown': 'Psychic',
'Ursaring': 'Normal',
'Uxie': 'Psychic',
'Vanillish': 'Ice',
'Vanillite': 'Ice',
'Vanilluxe': 'Ice',
'Vaporeon': 'Water',
'Venipede': 'Bug',
'Venomoth': 'Bug',
'Venonat': 'Bug',
'Venusaur': 'Grass',
'Vespiquen': 'Bug',
'Vibrava': 'Ground',
'Victini': 'Psychic',
'Victreebel': 'Grass',
'Vigoroth': 'Normal',
'Vileplume': 'Grass',
'Virizion': 'Grass',
'Vivillon': 'Bug',
'Volbeat': 'Bug',
'Volcanion': 'Fire',
'Volcarona': 'Bug',
'Voltorb': 'Electric',
'Vullaby': 'Dark',
'Vulpix': 'Fire',
'Wailmer': 'Water',
'Wailord': 'Water',
'Walrein': 'Ice',
'Wartortle': 'Water',
'Watchog': 'Normal',
'Weavile': 'Dark',
'Weedle': 'Bug',
'Weepinbell': 'Grass',
'Weezing': 'Poison',
'Whimsicott': 'Grass',
'Whirlipede': 'Bug',
'Whiscash': 'Water',
'Whismur': 'Normal',
'Wigglytuff': 'Normal',
'Wingull': 'Water',
'Wobbuffet': 'Psychic',
'Woobat': 'Psychic',
'Wooper': 'Water',
'Wormadam': 'Bug',
'Wurmple': 'Bug',
'Wynaut': 'Psychic',
'Xatu': 'Psychic',
'Xerneas': 'Fairy',
'Yamask': 'Ghost',
'Yanma': 'Bug',
'Yanmega': 'Bug',
'Yveltal': 'Dark',
'Zangoose': 'Normal',
'Zapdos': 'Electric',
'Zebstrika': 'Electric',
'Zekrom': 'Dragon',
'Zigzagoon': 'Normal',
'Zoroark': 'Dark',
'Zorua': 'Dark',
'Zubat': 'Poison',
'Zweilous': 'Dark',
'Zygarde': 'Dragon'}In [267]:
pokemon_names.map(pokemon_types)
Out[267]:
0 Grass
1 Grass
2 Grass
3 Fire
4 Fire
5 Fire
6 Water
7 Water
8 Water
9 Bug
10 Bug
11 Bug
12 Bug
13 Bug
14 Bug
15 Normal
16 Normal
17 Normal
18 Normal
19 Normal
20 Normal
21 Normal
22 Poison
23 Poison
24 Electric
25 Electric
26 Ground
27 Ground
28 Poison
29 Poison
...
691 Water
692 Water
693 Electric
694 Electric
695 Rock
696 Rock
697 Rock
698 Rock
699 Fairy
700 Fighting
701 Electric
702 Rock
703 Dragon
704 Dragon
705 Dragon
706 Steel
707 Ghost
708 Ghost
709 Ghost
710 Ghost
711 Ice
712 Ice
713 Flying
714 Flying
715 Fairy
716 Dark
717 Dragon
718 Rock
719 Psychic
720 Fire
Name: Pokemon, dtype: object