4. pandas使用2
import pandas as pd
import numpy as np
示例 股票数据离散化
stock=pd.read_csv("/home/python/练习/stock_day/stock_day.csv")
stock.head()
open | high | close | low | volume | price_change | p_change | ma5 | ma10 | ma20 | v_ma5 | v_ma10 | v_ma20 | turnover | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2018-02-27 | 23.53 | 25.88 | 24.16 | 23.53 | 95578.03 | 0.63 | 2.68 | 22.942 | 22.142 | 22.875 | 53782.64 | 46738.65 | 55576.11 | 2.39 |
2018-02-26 | 22.80 | 23.78 | 23.53 | 22.80 | 60985.11 | 0.69 | 3.02 | 22.406 | 21.955 | 22.942 | 40827.52 | 42736.34 | 56007.50 | 1.53 |
2018-02-23 | 22.88 | 23.37 | 22.82 | 22.71 | 52914.01 | 0.54 | 2.42 | 21.938 | 21.929 | 23.022 | 35119.58 | 41871.97 | 56372.85 | 1.32 |
2018-02-22 | 22.25 | 22.76 | 22.28 | 22.02 | 36105.01 | 0.36 | 1.64 | 21.446 | 21.909 | 23.137 | 35397.58 | 39904.78 | 60149.60 | 0.90 |
2018-02-14 | 21.49 | 21.99 | 21.92 | 21.48 | 23331.04 | 0.44 | 2.05 | 21.366 | 21.923 | 23.253 | 33590.21 | 42935.74 | 61716.11 | 0.58 |
qcut=pd.qcut(stock["p_change"], 10)qcut.value_counts<bound method IndexOpsMixin.value_counts of 2018-02-27 (1.738, 2.938]
2018-02-26 (2.938, 5.27]
2018-02-23 (1.738, 2.938]
2018-02-22 (0.94, 1.738]
2018-02-14 (1.738, 2.938]
2018-02-13 (0.94, 1.738]
2018-02-12 (2.938, 5.27]
2018-02-09 (-10.030999999999999, -4.836]
2018-02-08 (0.26, 0.94]
2018-02-07 (-2.444, -1.352]
2018-02-06 (-4.836, -2.444]
2018-02-05 (1.738, 2.938]
2018-02-02 (0.26, 0.94]
2018-02-01 (-10.030999999999999, -4.836]
2018-01-31 (-0.462, 0.26]
2018-01-30 (-0.462, 0.26]
2018-01-29 (-4.836, -2.444]
2018-01-26 (0.26, 0.94]
2018-01-25 (-4.836, -2.444]
2018-01-24 (-1.352, -0.462]
2018-01-23 (0.94, 1.738]
2018-01-22 (-0.462, 0.26]
2018-01-19 (1.738, 2.938]
2018-01-18 (-0.462, 0.26]
2018-01-17 (0.26, 0.94]
2018-01-16 (2.938, 5.27]
2018-01-15 (-4.836, -2.444]
2018-01-12 (1.738, 2.938]
2018-01-11 (-1.352, -0.462]
2018-01-10 (-1.352, -0.462]...
2015-04-13 (5.27, 10.03]
2015-04-10 (-1.352, -0.462]
2015-04-09 (5.27, 10.03]
2015-04-08 (2.938, 5.27]
2015-04-07 (5.27, 10.03]
2015-04-03 (0.94, 1.738]
2015-04-02 (0.26, 0.94]
2015-04-01 (0.26, 0.94]
2015-03-31 (-2.444, -1.352]
2015-03-30 (2.938, 5.27]
2015-03-27 (5.27, 10.03]
2015-03-26 (-2.444, -1.352]
2015-03-25 (-2.444, -1.352]
2015-03-24 (1.738, 2.938]
2015-03-23 (-0.462, 0.26]
2015-03-20 (-0.462, 0.26]
2015-03-19 (0.26, 0.94]
2015-03-18 (0.26, 0.94]
2015-03-17 (1.738, 2.938]
2015-03-16 (1.738, 2.938]
2015-03-13 (1.738, 2.938]
2015-03-12 (-1.352, -0.462]
2015-03-11 (-2.444, -1.352]
2015-03-10 (1.738, 2.938]
2015-03-09 (-0.462, 0.26]
2015-03-06 (5.27, 10.03]
2015-03-05 (1.738, 2.938]
2015-03-04 (0.94, 1.738]
2015-03-03 (0.94, 1.738]
2015-03-02 (1.738, 2.938]
Name: p_change, Length: 643, dtype: category
Categories (10, interval[float64]): [(-10.030999999999999, -4.836] < (-4.836, -2.444] < (-2.444, -1.352] < (-1.352, -0.462] ... (0.94, 1.738] < (1.738, 2.938] < (2.938, 5.27] < (5.27, 10.03]]>pd.get_dummies(qcut,prefix="rise")
rise_(-10.030999999999999, -4.836] | rise_(-4.836, -2.444] | rise_(-2.444, -1.352] | rise_(-1.352, -0.462] | rise_(-0.462, 0.26] | rise_(0.26, 0.94] | rise_(0.94, 1.738] | rise_(1.738, 2.938] | rise_(2.938, 5.27] | rise_(5.27, 10.03] | |
---|---|---|---|---|---|---|---|---|---|---|
2018-02-27 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
2018-02-26 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
2018-02-23 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
2018-02-22 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
2018-02-14 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
2018-02-13 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
2018-02-12 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
2018-02-09 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
2018-02-08 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
2018-02-07 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
2018-02-06 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
2018-02-05 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
2018-02-02 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
2018-02-01 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
2018-01-31 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
2018-01-30 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
2018-01-29 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
2018-01-26 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
2018-01-25 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
2018-01-24 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2018-01-23 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
2018-01-22 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
2018-01-19 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
2018-01-18 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
2018-01-17 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
2018-01-16 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
2018-01-15 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
2018-01-12 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
2018-01-11 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2018-01-10 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
2015-04-13 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
2015-04-10 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2015-04-09 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
2015-04-08 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
2015-04-07 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
2015-04-03 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
2015-04-02 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
2015-04-01 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
2015-03-31 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
2015-03-30 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
2015-03-27 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
2015-03-26 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
2015-03-25 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
2015-03-24 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
2015-03-23 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
2015-03-20 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
2015-03-19 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
2015-03-18 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
2015-03-17 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
2015-03-16 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
2015-03-13 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
2015-03-12 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2015-03-11 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
2015-03-10 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
2015-03-09 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
2015-03-06 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
2015-03-05 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
2015-03-04 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
2015-03-03 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
2015-03-02 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
643 rows × 10 columns
bins=[-100,-7,-5,-3,0,3,5,7,100]
cut=pd.cut(stock['p_change'], bins)
cut.value_counts<bound method IndexOpsMixin.value_counts of 2018-02-27 (0, 3]
2018-02-26 (3, 5]
2018-02-23 (0, 3]
2018-02-22 (0, 3]
2018-02-14 (0, 3]
2018-02-13 (0, 3]
2018-02-12 (3, 5]
2018-02-09 (-7, -5]
2018-02-08 (0, 3]
2018-02-07 (-3, 0]
2018-02-06 (-5, -3]
2018-02-05 (0, 3]
2018-02-02 (0, 3]
2018-02-01 (-7, -5]
2018-01-31 (-3, 0]
2018-01-30 (0, 3]
2018-01-29 (-3, 0]
2018-01-26 (0, 3]
2018-01-25 (-5, -3]
2018-01-24 (-3, 0]
2018-01-23 (0, 3]
2018-01-22 (-3, 0]
2018-01-19 (0, 3]
2018-01-18 (0, 3]
2018-01-17 (0, 3]
2018-01-16 (3, 5]
2018-01-15 (-5, -3]
2018-01-12 (0, 3]
2018-01-11 (-3, 0]
2018-01-10 (-3, 0]...
2015-04-13 (7, 100]
2015-04-10 (-3, 0]
2015-04-09 (5, 7]
2015-04-08 (5, 7]
2015-04-07 (5, 7]
2015-04-03 (0, 3]
2015-04-02 (0, 3]
2015-04-01 (0, 3]
2015-03-31 (-3, 0]
2015-03-30 (3, 5]
2015-03-27 (5, 7]
2015-03-26 (-3, 0]
2015-03-25 (-3, 0]
2015-03-24 (0, 3]
2015-03-23 (0, 3]
2015-03-20 (-3, 0]
2015-03-19 (0, 3]
2015-03-18 (0, 3]
2015-03-17 (0, 3]
2015-03-16 (0, 3]
2015-03-13 (0, 3]
2015-03-12 (-3, 0]
2015-03-11 (-3, 0]
2015-03-10 (0, 3]
2015-03-09 (0, 3]
2015-03-06 (7, 100]
2015-03-05 (0, 3]
2015-03-04 (0, 3]
2015-03-03 (0, 3]
2015-03-02 (0, 3]
Name: p_change, Length: 643, dtype: category
Categories (8, interval[int64]): [(-100, -7] < (-7, -5] < (-5, -3] < (-3, 0] < (0, 3] < (3, 5] < (5, 7] < (7, 100]]>one_hot=pd.get_dummies(qcut,prefix="涨跌幅").head()
one_hot
涨跌幅_(-10.030999999999999, -4.836] | 涨跌幅_(-4.836, -2.444] | 涨跌幅_(-2.444, -1.352] | 涨跌幅_(-1.352, -0.462] | 涨跌幅_(-0.462, 0.26] | 涨跌幅_(0.26, 0.94] | 涨跌幅_(0.94, 1.738] | 涨跌幅_(1.738, 2.938] | 涨跌幅_(2.938, 5.27] | 涨跌幅_(5.27, 10.03] | |
---|---|---|---|---|---|---|---|---|---|---|
2018-02-27 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
2018-02-26 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
2018-02-23 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
2018-02-22 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
2018-02-14 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
# 数据的合并
pd.concat([stock,one_hot],axis=1).head()
open | high | close | low | volume | price_change | p_change | ma5 | ma10 | ma20 | ... | 涨跌幅_(-10.030999999999999, -4.836] | 涨跌幅_(-4.836, -2.444] | 涨跌幅_(-2.444, -1.352] | 涨跌幅_(-1.352, -0.462] | 涨跌幅_(-0.462, 0.26] | 涨跌幅_(0.26, 0.94] | 涨跌幅_(0.94, 1.738] | 涨跌幅_(1.738, 2.938] | 涨跌幅_(2.938, 5.27] | 涨跌幅_(5.27, 10.03] | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2015-03-02 | 12.25 | 12.67 | 12.52 | 12.20 | 96291.73 | 0.32 | 2.62 | 12.520 | 12.520 | 12.520 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
2015-03-03 | 12.52 | 13.06 | 12.70 | 12.52 | 139071.61 | 0.18 | 1.44 | 12.610 | 12.610 | 12.610 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
2015-03-04 | 12.80 | 12.92 | 12.90 | 12.61 | 67075.44 | 0.20 | 1.57 | 12.707 | 12.707 | 12.707 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
2015-03-05 | 12.88 | 13.45 | 13.16 | 12.87 | 93180.39 | 0.26 | 2.02 | 12.820 | 12.820 | 12.820 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
2015-03-06 | 13.17 | 14.48 | 14.28 | 13.13 | 179831.72 | 1.12 | 8.51 | 13.112 | 13.112 | 13.112 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
5 rows × 24 columns
stock
open | high | close | low | volume | price_change | p_change | ma5 | ma10 | ma20 | v_ma5 | v_ma10 | v_ma20 | turnover | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2018-02-27 | 23.53 | 25.88 | 24.16 | 23.53 | 95578.03 | 0.63 | 2.68 | 22.942 | 22.142 | 22.875 | 53782.64 | 46738.65 | 55576.11 | 2.39 |
2018-02-26 | 22.80 | 23.78 | 23.53 | 22.80 | 60985.11 | 0.69 | 3.02 | 22.406 | 21.955 | 22.942 | 40827.52 | 42736.34 | 56007.50 | 1.53 |
2018-02-23 | 22.88 | 23.37 | 22.82 | 22.71 | 52914.01 | 0.54 | 2.42 | 21.938 | 21.929 | 23.022 | 35119.58 | 41871.97 | 56372.85 | 1.32 |
2018-02-22 | 22.25 | 22.76 | 22.28 | 22.02 | 36105.01 | 0.36 | 1.64 | 21.446 | 21.909 | 23.137 | 35397.58 | 39904.78 | 60149.60 | 0.90 |
2018-02-14 | 21.49 | 21.99 | 21.92 | 21.48 | 23331.04 | 0.44 | 2.05 | 21.366 | 21.923 | 23.253 | 33590.21 | 42935.74 | 61716.11 | 0.58 |
2018-02-13 | 21.40 | 21.90 | 21.48 | 21.31 | 30802.45 | 0.28 | 1.32 | 21.342 | 22.103 | 23.387 | 39694.65 | 45518.14 | 65161.68 | 0.77 |
2018-02-12 | 20.70 | 21.40 | 21.19 | 20.63 | 32445.39 | 0.82 | 4.03 | 21.504 | 22.338 | 23.533 | 44645.16 | 45679.94 | 68686.33 | 0.81 |
2018-02-09 | 21.20 | 21.46 | 20.36 | 20.19 | 54304.01 | -1.50 | -6.86 | 21.920 | 22.596 | 23.645 | 48624.36 | 48982.38 | 70552.47 | 1.36 |
2018-02-08 | 21.79 | 22.09 | 21.88 | 21.75 | 27068.16 | 0.09 | 0.41 | 22.372 | 23.009 | 23.839 | 44411.98 | 48612.16 | 73852.45 | 0.68 |
2018-02-07 | 22.69 | 23.11 | 21.80 | 21.29 | 53853.25 | -0.50 | -2.24 | 22.480 | 23.258 | 23.929 | 52281.28 | 56315.11 | 74925.33 | 1.35 |
2018-02-06 | 22.80 | 23.55 | 22.29 | 22.20 | 55555.00 | -0.97 | -4.17 | 22.864 | 23.607 | 24.029 | 51341.63 | 64413.58 | 75738.95 | 1.39 |
2018-02-05 | 22.45 | 23.39 | 23.27 | 22.25 | 52341.39 | 0.65 | 2.87 | 23.172 | 23.928 | 24.112 | 46714.72 | 69278.66 | 77070.00 | 1.31 |
2018-02-02 | 22.40 | 22.70 | 22.62 | 21.53 | 33242.11 | 0.20 | 0.89 | 23.272 | 24.114 | 24.184 | 49340.40 | 70873.73 | 79929.71 | 0.83 |
2018-02-01 | 23.71 | 23.86 | 22.42 | 22.22 | 66414.64 | -1.30 | -5.48 | 23.646 | 24.365 | 24.279 | 52812.35 | 80394.43 | 88480.92 | 1.66 |
2018-01-31 | 23.85 | 23.98 | 23.72 | 23.31 | 49155.02 | -0.11 | -0.46 | 24.036 | 24.583 | 24.411 | 60348.94 | 80496.48 | 91666.75 | 1.23 |
2018-01-30 | 23.71 | 24.08 | 23.83 | 23.70 | 32420.43 | 0.05 | 0.21 | 24.350 | 24.671 | 24.365 | 77485.53 | 84805.23 | 92943.35 | 0.81 |
2018-01-29 | 24.40 | 24.63 | 23.77 | 23.72 | 65469.81 | -0.73 | -2.98 | 24.684 | 24.728 | 24.294 | 91842.60 | 91692.73 | 93456.22 | 1.64 |
2018-01-26 | 24.27 | 24.74 | 24.49 | 24.22 | 50601.83 | 0.11 | 0.45 | 24.956 | 24.694 | 24.221 | 92407.05 | 92122.56 | 91980.51 | 1.27 |
2018-01-25 | 24.99 | 24.99 | 24.37 | 24.23 | 104097.59 | -0.93 | -3.68 | 25.084 | 24.669 | 24.109 | 107976.51 | 99092.73 | 92262.67 | 2.61 |
2018-01-24 | 25.49 | 26.28 | 25.29 | 25.20 | 134838.00 | -0.20 | -0.79 | 25.130 | 24.599 | 23.997 | 100644.02 | 93535.55 | 89522.22 | 3.37 |
2018-01-23 | 25.15 | 25.53 | 25.50 | 24.93 | 104205.76 | 0.39 | 1.55 | 24.992 | 24.450 | 23.844 | 92124.92 | 87064.33 | 85876.80 | 2.61 |
2018-01-22 | 25.14 | 25.40 | 25.13 | 24.75 | 68292.08 | -0.01 | -0.04 | 24.772 | 24.296 | 23.644 | 91542.85 | 84861.33 | 84970.00 | 1.71 |
2018-01-19 | 24.60 | 25.34 | 25.13 | 24.42 | 128449.11 | 0.53 | 2.15 | 24.432 | 24.254 | 23.537 | 91838.07 | 88985.70 | 82975.10 | 3.21 |
2018-01-18 | 24.40 | 24.88 | 24.60 | 24.30 | 67435.14 | 0.01 | 0.04 | 24.254 | 24.192 | 23.441 | 90208.95 | 96567.41 | 78252.92 | 1.69 |
2018-01-17 | 24.42 | 24.92 | 24.60 | 23.80 | 92242.51 | 0.20 | 0.82 | 24.068 | 24.239 | 23.378 | 86427.08 | 102837.01 | 77049.61 | 2.31 |
2018-01-16 | 23.40 | 24.60 | 24.40 | 23.30 | 101295.42 | 0.96 | 4.10 | 23.908 | 24.058 | 23.321 | 82003.73 | 101081.47 | 74590.92 | 2.54 |
2018-01-15 | 24.01 | 24.23 | 23.43 | 23.30 | 69768.17 | -0.80 | -3.30 | 23.820 | 23.860 | 23.257 | 78179.81 | 95219.71 | 71006.65 | 1.75 |
2018-01-12 | 23.70 | 25.15 | 24.24 | 23.42 | 120303.53 | 0.56 | 2.37 | 24.076 | 23.748 | 23.236 | 86133.33 | 91838.46 | 69690.35 | 3.01 |
2018-01-11 | 23.67 | 23.85 | 23.67 | 23.21 | 48525.75 | -0.12 | -0.50 | 24.130 | 23.548 | 23.197 | 102925.87 | 85432.61 | 65928.23 | 1.21 |
2018-01-10 | 24.10 | 24.60 | 23.80 | 23.40 | 70125.79 | -0.14 | -0.58 | 24.410 | 23.394 | 23.204 | 119246.95 | 85508.89 | 66934.89 | 1.76 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
2015-04-13 | 19.60 | 21.30 | 21.13 | 19.50 | 171822.69 | 1.70 | 8.75 | 19.228 | 17.812 | 16.563 | 149620.34 | 114456.84 | 111752.31 | 5.88 |
2015-04-10 | 19.55 | 19.89 | 19.43 | 19.20 | 112962.15 | -0.19 | -0.97 | 18.334 | 17.276 | 16.230 | 133648.38 | 109309.78 | 106228.29 | 3.87 |
2015-04-09 | 18.28 | 19.89 | 19.62 | 18.02 | 183119.05 | 1.20 | 6.51 | 17.736 | 16.826 | 15.964 | 124323.21 | 106501.34 | 104829.10 | 6.27 |
2015-04-08 | 17.60 | 18.53 | 18.42 | 17.60 | 157725.97 | 0.88 | 5.02 | 17.070 | 16.394 | 15.698 | 101421.29 | 97906.88 | 101658.57 | 5.40 |
2015-04-07 | 16.54 | 17.98 | 17.54 | 16.50 | 122471.85 | 0.88 | 5.28 | 16.620 | 16.120 | 15.510 | 86769.62 | 97473.29 | 98832.94 | 4.19 |
2015-04-03 | 16.44 | 16.77 | 16.66 | 16.25 | 91962.88 | 0.22 | 1.34 | 16.396 | 15.904 | 15.348 | 79293.34 | 94172.24 | 99956.63 | 3.15 |
2015-04-02 | 16.21 | 16.50 | 16.44 | 16.21 | 66336.32 | 0.15 | 0.92 | 16.218 | 15.772 | 15.229 | 84971.19 | 92655.96 | 104350.08 | 2.27 |
2015-04-01 | 16.18 | 16.48 | 16.29 | 16.00 | 68609.42 | 0.12 | 0.74 | 15.916 | 15.666 | 15.065 | 88679.47 | 95386.75 | 105692.28 | 2.35 |
2015-03-31 | 16.78 | 16.88 | 16.17 | 16.07 | 84467.62 | -0.25 | -1.52 | 15.718 | 15.568 | 14.896 | 94392.47 | 100679.68 | 105615.58 | 2.89 |
2015-03-30 | 15.99 | 16.63 | 16.42 | 15.99 | 85090.45 | 0.65 | 4.12 | 15.620 | 15.469 | 14.722 | 108176.96 | 108109.99 | 108345.78 | 2.91 |
2015-03-27 | 14.90 | 15.86 | 15.77 | 14.90 | 120352.13 | 0.84 | 5.63 | 15.412 | 15.314 | 14.527 | 109051.14 | 109047.78 | 108905.84 | 4.12 |
2015-03-26 | 15.14 | 15.35 | 14.93 | 14.91 | 84877.75 | -0.37 | -2.42 | 15.326 | 15.184 | 14.462 | 100340.74 | 103146.79 | 108303.41 | 2.91 |
2015-03-25 | 15.97 | 15.97 | 15.30 | 15.18 | 97174.40 | -0.38 | -2.42 | 15.416 | 15.102 | 14.436 | 102094.02 | 103156.85 | 109604.83 | 3.33 |
2015-03-24 | 15.38 | 16.16 | 15.68 | 15.28 | 153390.08 | 0.30 | 1.95 | 15.418 | 15.002 | 14.385 | 106966.89 | 105410.25 | 110336.03 | 5.25 |
2015-03-23 | 15.34 | 15.56 | 15.38 | 15.25 | 89461.32 | 0.04 | 0.26 | 15.318 | 14.899 | 14.304 | 108043.02 | 100192.60 | 107645.16 | 3.06 |
2015-03-20 | 15.38 | 15.48 | 15.34 | 15.18 | 76800.13 | -0.04 | -0.26 | 15.216 | 14.792 | 14.232 | 109044.42 | 105741.03 | 108857.41 | 2.63 |
2015-03-19 | 15.20 | 15.64 | 15.38 | 15.11 | 93644.19 | 0.07 | 0.46 | 15.042 | 14.686 | 14.153 | 105952.84 | 116044.19 | 111147.22 | 3.21 |
2015-03-18 | 15.18 | 15.66 | 15.31 | 15.02 | 121538.71 | 0.13 | 0.86 | 14.788 | 14.464 | 14.058 | 104219.67 | 115997.81 | 112493.60 | 4.16 |
2015-03-17 | 14.90 | 15.44 | 15.18 | 14.63 | 158770.77 | 0.31 | 2.08 | 14.586 | 14.223 | 13.954 | 103853.62 | 110551.48 | 111739.85 | 5.43 |
2015-03-16 | 14.52 | 15.05 | 14.87 | 14.51 | 94468.30 | 0.40 | 2.76 | 14.480 | 13.975 | 13.843 | 92342.17 | 108581.56 | 107464.31 | 3.23 |
2015-03-13 | 14.13 | 14.50 | 14.47 | 14.08 | 61342.22 | 0.36 | 2.55 | 14.368 | 13.740 | 13.740 | 102437.64 | 108763.91 | 108763.91 | 2.10 |
2015-03-12 | 14.11 | 14.80 | 14.11 | 13.95 | 84978.37 | -0.19 | -1.33 | 14.330 | 13.659 | 13.659 | 126135.54 | 114032.98 | 114032.98 | 2.91 |
2015-03-11 | 14.80 | 15.08 | 14.30 | 14.14 | 119708.43 | -0.35 | -2.39 | 14.140 | 13.603 | 13.603 | 127775.94 | 117664.81 | 117664.81 | 4.10 |
2015-03-10 | 14.20 | 14.80 | 14.65 | 14.01 | 101213.51 | 0.34 | 2.38 | 13.860 | 13.503 | 13.503 | 117249.34 | 117372.87 | 117372.87 | 3.46 |
2015-03-09 | 14.14 | 14.85 | 14.31 | 13.80 | 144945.66 | 0.03 | 0.21 | 13.470 | 13.312 | 13.312 | 124820.96 | 120066.09 | 120066.09 | 4.96 |
2015-03-06 | 13.17 | 14.48 | 14.28 | 13.13 | 179831.72 | 1.12 | 8.51 | 13.112 | 13.112 | 13.112 | 115090.18 | 115090.18 | 115090.18 | 6.16 |
2015-03-05 | 12.88 | 13.45 | 13.16 | 12.87 | 93180.39 | 0.26 | 2.02 | 12.820 | 12.820 | 12.820 | 98904.79 | 98904.79 | 98904.79 | 3.19 |
2015-03-04 | 12.80 | 12.92 | 12.90 | 12.61 | 67075.44 | 0.20 | 1.57 | 12.707 | 12.707 | 12.707 | 100812.93 | 100812.93 | 100812.93 | 2.30 |
2015-03-03 | 12.52 | 13.06 | 12.70 | 12.52 | 139071.61 | 0.18 | 1.44 | 12.610 | 12.610 | 12.610 | 117681.67 | 117681.67 | 117681.67 | 4.76 |
2015-03-02 | 12.25 | 12.67 | 12.52 | 12.20 | 96291.73 | 0.32 | 2.62 | 12.520 | 12.520 | 12.520 | 96291.73 | 96291.73 | 96291.73 | 3.30 |
643 rows × 14 columns
# 1、先根据对应的日期找到星期几
date = pd.to_datetime(stock.index).weekday
stock['week'] = date# 2、把p_change按照大小分类,以0为界限
stock['posi_neg'] = np.where(stock['p_change'] > 0, 1, 0)# 通过交叉表找寻两列数据的关系
data = pd.crosstab(stock['week'], stock['posi_neg'])data
posi_neg | 0 | 1 |
---|---|---|
week | ||
0 | 63 | 62 |
1 | 55 | 76 |
2 | 61 | 71 |
3 | 63 | 65 |
4 | 59 | 68 |
pona_sum=data.sum(axis=1)pona_sumweek
0 125
1 131
2 132
3 128
4 127
dtype: int64data=data.div(pona_sum,axis=0)
data
posi_neg | 0 | 1 |
---|---|---|
week | ||
0 | 0.504000 | 0.496000 |
1 | 0.419847 | 0.580153 |
2 | 0.462121 | 0.537879 |
3 | 0.492188 | 0.507812 |
4 | 0.464567 | 0.535433 |
data.plot(kind="bar",stacked=True)<matplotlib.axes._subplots.AxesSubplot at 0x7f8cd40efeb8># 透视表实现更加简单stock.pivot_table(["posi_neg"],index=["week"])
posi_neg | |
---|---|
week | |
0 | 0.496000 |
1 | 0.580153 |
2 | 0.537879 |
3 | 0.507812 |
4 | 0.535433 |
# 分组
col =pd.DataFrame({'color': ['white','red','green','red','green'], 'object': ['pen','pencil','pencil','ashtray','pen'],'price1':[5.56,4.20,1.30,0.56,2.75],'price2':[4.75,4.12,1.60,0.75,3.15]})col
color | object | price1 | price2 | |
---|---|---|---|---|
0 | white | pen | 5.56 | 4.75 |
1 | red | pencil | 4.20 | 4.12 |
2 | green | pencil | 1.30 | 1.60 |
3 | red | ashtray | 0.56 | 0.75 |
4 | green | pen | 2.75 | 3.15 |
col.groupby(['color'])['price1'].mean()color
green 2.025
red 2.380
white 5.560
Name: price1, dtype: float64col.groupby(['color'], as_index=False)['price1'].mean()
color | price1 | |
---|---|---|
0 | green | 2.025 |
1 | red | 2.380 |
2 | white | 5.560 |
综合示例
movie=pd.read_csv("/home/python/练习/IMDB/IMDB-Movie-Data.csv")movie.head()
Rank | Title | Genre | Description | Director | Actors | Year | Runtime (Minutes) | Rating | Votes | Revenue (Millions) | Metascore | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | Guardians of the Galaxy | Action,Adventure,Sci-Fi | A group of intergalactic criminals are forced ... | James Gunn | Chris Pratt, Vin Diesel, Bradley Cooper, Zoe S... | 2014 | 121 | 8.1 | 757074 | 333.13 | 76.0 |
1 | 2 | Prometheus | Adventure,Mystery,Sci-Fi | Following clues to the origin of mankind, a te... | Ridley Scott | Noomi Rapace, Logan Marshall-Green, Michael Fa... | 2012 | 124 | 7.0 | 485820 | 126.46 | 65.0 |
2 | 3 | Split | Horror,Thriller | Three girls are kidnapped by a man with a diag... | M. Night Shyamalan | James McAvoy, Anya Taylor-Joy, Haley Lu Richar... | 2016 | 117 | 7.3 | 157606 | 138.12 | 62.0 |
3 | 4 | Sing | Animation,Comedy,Family | In a city of humanoid animals, a hustling thea... | Christophe Lourdelet | Matthew McConaughey,Reese Witherspoon, Seth Ma... | 2016 | 108 | 7.2 | 60545 | 270.32 | 59.0 |
4 | 5 | Suicide Squad | Action,Adventure,Fantasy | A secret government agency recruits some of th... | David Ayer | Will Smith, Jared Leto, Margot Robbie, Viola D... | 2016 | 123 | 6.2 | 393727 | 325.02 | 40.0 |
# 想知道这些电影数据中评分的平均分,导演的人数等信息,我们应该怎么获取?mean=movie["Rating"].mean()
print("电影平均分为{}".format(mean))电影平均分为6.723199999999999director_count=movie["Director"].unique().size
print("共有{}名导演".format(director_count))共有644名导演# 2 对于这一组电影数据,如果我们想看Rating,Runtime (Minutes)的分布情况,应该如何呈现数据?movie["Rating"].plot(kind="hist",figsize=(20,8),bins=20)<matplotlib.axes._subplots.AxesSubplot at 0x7f8cd1b40b38>import matplotlib.pyplot as plt
plt.figure(figsize=(20,8),dpi=80)
plt.hist(movie["Rating"].values,bins=20)#求出最大最小值
max_ = movie["Rating"].max()
min_ = movie["Rating"].min()# 生成刻度列表
t1 = np.linspace(min_,max_,num=21)# [ 1.9 2.255 2.61 2.965 3.32 3.675 4.03 4.385 4.74 5.095 5.45 5.805 6.16 6.515 6.87 7.225 7.58 7.935 8.29 8.645 9. ]# 修改刻度
plt.xticks(np.linspace(min_,max_,num=21))# 添加网格
plt.grid()plt.show()# 3 对于这一组电影数据,如果我们希望统计电影分类(genre)的情况,应该如何处理数据?movie.head()
Rank | Title | Genre | Description | Director | Actors | Year | Runtime (Minutes) | Rating | Votes | Revenue (Millions) | Metascore | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | Guardians of the Galaxy | Action,Adventure,Sci-Fi | A group of intergalactic criminals are forced ... | James Gunn | Chris Pratt, Vin Diesel, Bradley Cooper, Zoe S... | 2014 | 121 | 8.1 | 757074 | 333.13 | 76.0 |
1 | 2 | Prometheus | Adventure,Mystery,Sci-Fi | Following clues to the origin of mankind, a te... | Ridley Scott | Noomi Rapace, Logan Marshall-Green, Michael Fa... | 2012 | 124 | 7.0 | 485820 | 126.46 | 65.0 |
2 | 3 | Split | Horror,Thriller | Three girls are kidnapped by a man with a diag... | M. Night Shyamalan | James McAvoy, Anya Taylor-Joy, Haley Lu Richar... | 2016 | 117 | 7.3 | 157606 | 138.12 | 62.0 |
3 | 4 | Sing | Animation,Comedy,Family | In a city of humanoid animals, a hustling thea... | Christophe Lourdelet | Matthew McConaughey,Reese Witherspoon, Seth Ma... | 2016 | 108 | 7.2 | 60545 | 270.32 | 59.0 |
4 | 5 | Suicide Squad | Action,Adventure,Fantasy | A secret government agency recruits some of th... | David Ayer | Will Smith, Jared Leto, Margot Robbie, Viola D... | 2016 | 123 | 6.2 | 393727 | 325.02 | 40.0 |
# 先获取类别的清单
class_list=[i.split(",")for i in movie["Genre"]]class_list[['Action', 'Adventure', 'Sci-Fi'],['Adventure', 'Mystery', 'Sci-Fi'],['Horror', 'Thriller'],['Animation', 'Comedy', 'Family'],['Action', 'Adventure', 'Fantasy'],['Action', 'Adventure', 'Fantasy'],['Comedy', 'Drama', 'Music'],['Comedy'],['Action', 'Adventure', 'Biography'],['Adventure', 'Drama', 'Romance'],['Adventure', 'Family', 'Fantasy'],['Biography', 'Drama', 'History'],['Action', 'Adventure', 'Sci-Fi'],['Animation', 'Adventure', 'Comedy'],['Action', 'Comedy', 'Drama'],['Animation', 'Adventure', 'Comedy'],['Biography', 'Drama', 'History'],['Action', 'Thriller'],['Biography', 'Drama'],['Drama', 'Mystery', 'Sci-Fi'],['Adventure', 'Drama', 'Thriller'],['Drama'],['Crime', 'Drama', 'Horror'],['Animation', 'Adventure', 'Comedy'],['Action', 'Adventure', 'Sci-Fi'],['Comedy'],['Action', 'Adventure', 'Drama'],['Horror', 'Thriller'],['Comedy'],['Action', 'Adventure', 'Drama'],['Comedy'],['Drama', 'Thriller'],['Action', 'Adventure', 'Sci-Fi'],['Action', 'Adventure', 'Comedy'],['Action', 'Horror', 'Sci-Fi'],['Action', 'Adventure', 'Sci-Fi'],['Adventure', 'Drama', 'Sci-Fi'],['Action', 'Adventure', 'Fantasy'],['Action', 'Adventure', 'Western'],['Comedy', 'Drama'],['Animation', 'Adventure', 'Comedy'],['Drama'],['Horror'],['Biography', 'Drama', 'History'],['Drama'],['Action', 'Adventure', 'Fantasy'],['Drama', 'Thriller'],['Adventure', 'Drama', 'Fantasy'],['Action', 'Adventure', 'Sci-Fi'],['Drama'],['Action', 'Adventure', 'Fantasy'],['Action', 'Adventure', 'Fantasy'],['Comedy', 'Drama'],['Action', 'Crime', 'Thriller'],['Action', 'Crime', 'Drama'],['Adventure', 'Drama', 'History'],['Crime', 'Horror', 'Thriller'],['Drama', 'Romance'],['Comedy', 'Drama', 'Romance'],['Biography', 'Drama'],['Action', 'Adventure', 'Sci-Fi'],['Horror', 'Mystery', 'Thriller'],['Crime', 'Drama', 'Mystery'],['Drama', 'Romance', 'Thriller'],['Drama', 'Mystery', 'Sci-Fi'],['Action', 'Adventure', 'Comedy'],['Drama', 'History', 'Thriller'],['Action', 'Adventure', 'Sci-Fi'],['Drama'],['Action', 'Drama', 'Thriller'],['Drama', 'History'],['Action', 'Drama', 'Romance'],['Drama', 'Fantasy'],['Drama', 'Romance'],['Animation', 'Adventure', 'Comedy'],['Action', 'Adventure', 'Fantasy'],['Action', 'Sci-Fi'],['Adventure', 'Drama', 'War'],['Action', 'Adventure', 'Fantasy'],['Action', 'Comedy', 'Fantasy'],['Action', 'Adventure', 'Sci-Fi'],['Comedy', 'Drama'],['Biography', 'Comedy', 'Crime'],['Crime', 'Drama', 'Mystery'],['Action', 'Crime', 'Thriller'],['Action', 'Adventure', 'Sci-Fi'],['Crime', 'Drama'],['Action', 'Adventure', 'Fantasy'],['Crime', 'Drama', 'Mystery'],['Action', 'Crime', 'Drama'],['Crime', 'Drama', 'Mystery'],['Action', 'Adventure', 'Fantasy'],['Drama'],['Comedy', 'Crime', 'Drama'],['Action', 'Adventure', 'Sci-Fi'],['Action', 'Comedy', 'Crime'],['Animation', 'Drama', 'Fantasy'],['Horror', 'Mystery', 'Sci-Fi'],['Drama', 'Mystery', 'Thriller'],['Crime', 'Drama', 'Thriller'],['Biography', 'Crime', 'Drama'],['Action', 'Adventure', 'Fantasy'],['Adventure', 'Drama', 'Sci-Fi'],['Crime', 'Mystery', 'Thriller'],['Action', 'Adventure', 'Comedy'],['Crime', 'Drama', 'Thriller'],['Comedy'],['Action', 'Adventure', 'Drama'],['Drama'],['Drama', 'Mystery', 'Sci-Fi'],['Action', 'Horror', 'Thriller'],['Biography', 'Drama', 'History'],['Romance', 'Sci-Fi'],['Action', 'Fantasy', 'War'],['Adventure', 'Drama', 'Fantasy'],['Comedy'],['Horror', 'Thriller'],['Action', 'Biography', 'Drama'],['Drama', 'Horror', 'Mystery'],['Animation', 'Adventure', 'Comedy'],['Adventure', 'Drama', 'Family'],['Adventure', 'Mystery', 'Sci-Fi'],['Adventure', 'Comedy', 'Romance'],['Action'],['Action', 'Thriller'],['Adventure', 'Drama', 'Family'],['Action', 'Adventure', 'Sci-Fi'],['Adventure', 'Crime', 'Mystery'],['Comedy', 'Family', 'Musical'],['Adventure', 'Drama', 'Thriller'],['Drama'],['Adventure', 'Comedy', 'Drama'],['Drama', 'Horror', 'Thriller'],['Drama', 'Music'],['Action', 'Crime', 'Thriller'],['Crime', 'Drama', 'Thriller'],['Crime', 'Drama', 'Thriller'],['Drama', 'Romance'],['Mystery', 'Thriller'],['Mystery', 'Thriller', 'Western'],['Action', 'Adventure', 'Sci-Fi'],['Comedy', 'Family'],['Biography', 'Comedy', 'Drama'],['Drama'],['Drama', 'Western'],['Drama', 'Mystery', 'Romance'],['Comedy', 'Drama'],['Action', 'Drama', 'Mystery'],['Comedy'],['Action', 'Adventure', 'Crime'],['Adventure', 'Family', 'Fantasy'],['Adventure', 'Sci-Fi', 'Thriller'],['Drama'],['Action', 'Crime', 'Drama'],['Drama', 'Horror', 'Mystery'],['Action', 'Horror', 'Sci-Fi'],['Action', 'Adventure', 'Sci-Fi'],['Comedy', 'Drama', 'Romance'],['Action', 'Comedy', 'Fantasy'],['Action', 'Comedy', 'Mystery'],['Thriller', 'War'],['Action', 'Comedy', 'Crime'],['Action', 'Adventure', 'Sci-Fi'],['Action', 'Adventure', 'Crime'],['Action', 'Adventure', 'Thriller'],['Drama', 'Fantasy', 'Romance'],['Action', 'Adventure', 'Comedy'],['Biography', 'Drama', 'History'],['Action', 'Drama', 'History'],['Action', 'Adventure', 'Thriller'],['Crime', 'Drama', 'Thriller'],['Animation', 'Adventure', 'Family'],['Adventure', 'Horror'],['Drama', 'Romance', 'Sci-Fi'],['Animation', 'Adventure', 'Comedy'],['Action', 'Adventure', 'Family'],['Action', 'Adventure', 'Drama'],['Action', 'Comedy'],['Horror', 'Mystery', 'Thriller'],['Action', 'Adventure', 'Comedy'],['Comedy', 'Romance'],['Horror', 'Mystery'],['Drama', 'Family', 'Fantasy'],['Sci-Fi'],['Drama', 'Thriller'],['Drama', 'Romance'],['Drama', 'War'],['Drama', 'Fantasy', 'Horror'],['Crime', 'Drama'],['Comedy', 'Drama', 'Romance'],['Drama', 'Romance'],['Drama'],['Crime', 'Drama', 'History'],['Horror', 'Sci-Fi', 'Thriller'],['Action', 'Drama', 'Sport'],['Action', 'Adventure', 'Sci-Fi'],['Crime', 'Drama', 'Thriller'],['Adventure', 'Biography', 'Drama'],['Biography', 'Drama', 'Thriller'],['Action', 'Comedy', 'Crime'],['Action', 'Adventure', 'Sci-Fi'],['Drama', 'Fantasy', 'Horror'],['Biography', 'Drama', 'Thriller'],['Action', 'Adventure', 'Sci-Fi'],['Action', 'Adventure', 'Mystery'],['Action', 'Adventure', 'Sci-Fi'],['Drama', 'Horror'],['Comedy', 'Drama', 'Romance'],['Comedy', 'Romance'],['Drama', 'Horror', 'Thriller'],['Action', 'Adventure', 'Drama'],['Drama'],['Action', 'Adventure', 'Sci-Fi'],['Action', 'Drama', 'Mystery'],['Action', 'Adventure', 'Fantasy'],['Action', 'Adventure', 'Fantasy'],['Action', 'Adventure', 'Sci-Fi'],['Action', 'Adventure', 'Comedy'],['Drama', 'Horror'],['Action', 'Comedy'],['Action', 'Adventure', 'Sci-Fi'],['Animation', 'Adventure', 'Comedy'],['Horror', 'Mystery'],['Crime', 'Drama', 'Mystery'],['Comedy', 'Crime'],['Drama'],['Comedy', 'Drama', 'Romance'],['Action', 'Adventure', 'Sci-Fi'],['Action', 'Adventure', 'Family'],['Horror', 'Sci-Fi', 'Thriller'],['Drama', 'Fantasy', 'War'],['Crime', 'Drama', 'Thriller'],['Action', 'Adventure', 'Drama'],['Action', 'Adventure', 'Thriller'],['Action', 'Adventure', 'Drama'],['Drama', 'Romance'],['Biography', 'Drama', 'History'],['Drama', 'Horror', 'Thriller'],['Adventure', 'Comedy', 'Drama'],['Action', 'Adventure', 'Romance'],['Action', 'Drama', 'War'],['Animation', 'Adventure', 'Comedy'],['Animation', 'Adventure', 'Comedy'],['Action', 'Adventure', 'Sci-Fi'],['Adventure', 'Family', 'Fantasy'],['Drama', 'Musical', 'Romance'],['Drama', 'Sci-Fi', 'Thriller'],['Comedy', 'Drama'],['Action', 'Comedy', 'Crime'],['Biography', 'Comedy', 'Drama'],['Comedy', 'Drama', 'Romance'],['Drama', 'Thriller'],['Biography', 'Drama', 'History'],['Action', 'Adventure', 'Sci-Fi'],['Horror', 'Mystery', 'Thriller'],['Comedy'],['Action', 'Adventure', 'Sci-Fi'],['Action', 'Drama', 'Sci-Fi'],['Horror'],['Drama', 'Thriller'],['Comedy', 'Drama', 'Romance'],['Drama', 'Thriller'],['Comedy', 'Drama'],['Drama'],['Action', 'Adventure', 'Comedy'],['Drama', 'Horror', 'Thriller'],['Comedy'],['Drama', 'Sci-Fi'],['Action', 'Adventure', 'Sci-Fi'],['Horror'],['Action', 'Adventure', 'Thriller'],['Adventure', 'Fantasy'],['Action', 'Comedy', 'Crime'],['Comedy', 'Drama', 'Music'],['Animation', 'Adventure', 'Comedy'],['Action', 'Adventure', 'Mystery'],['Action', 'Comedy', 'Crime'],['Crime', 'Drama', 'History'],['Comedy'],['Action', 'Adventure', 'Sci-Fi'],['Crime', 'Mystery', 'Thriller'],['Action', 'Adventure', 'Crime'],['Thriller'],['Biography', 'Drama', 'Romance'],['Action', 'Adventure'],['Action', 'Fantasy'],['Action', 'Comedy'],['Action', 'Adventure', 'Sci-Fi'],['Action', 'Comedy', 'Crime'],['Thriller'],['Action', 'Drama', 'Horror'],['Comedy', 'Music', 'Romance'],['Comedy'],['Drama'],['Action', 'Adventure', 'Fantasy'],['Drama', 'Romance'],['Animation', 'Adventure', 'Comedy'],['Comedy', 'Drama'],['Biography', 'Crime', 'Drama'],['Drama', 'History'],['Action', 'Crime', 'Thriller'],['Action', 'Biography', 'Drama'],['Horror'],['Comedy', 'Romance'],['Comedy', 'Romance'],['Comedy', 'Crime', 'Drama'],['Adventure', 'Family', 'Fantasy'],['Crime', 'Drama', 'Thriller'],['Action', 'Crime', 'Thriller'],['Comedy', 'Romance'],['Biography', 'Drama', 'Sport'],['Drama', 'Romance'],['Drama', 'Horror'],['Adventure', 'Fantasy'],['Adventure', 'Family', 'Fantasy'],['Action', 'Drama', 'Sci-Fi'],['Action', 'Adventure', 'Sci-Fi'],['Action', 'Horror'],['Comedy', 'Horror', 'Thriller'],['Action', 'Crime', 'Thriller'],['Crime', 'Drama', 'Music'],['Drama'],['Action', 'Crime', 'Thriller'],['Action', 'Sci-Fi', 'Thriller'],['Biography', 'Drama'],['Action', 'Adventure', 'Fantasy'],['Drama', 'Horror', 'Sci-Fi'],['Biography', 'Comedy', 'Drama'],['Crime', 'Horror', 'Thriller'],['Crime', 'Drama', 'Mystery'],['Animation', 'Adventure', 'Comedy'],['Action', 'Biography', 'Drama'],['Biography', 'Drama'],['Biography', 'Drama', 'History'],['Action', 'Biography', 'Drama'],['Drama', 'Fantasy', 'Horror'],['Comedy', 'Drama', 'Romance'],['Drama', 'Sport'],['Drama', 'Romance'],['Comedy', 'Romance'],['Action', 'Crime', 'Thriller'],['Action', 'Crime', 'Drama'],['Action', 'Drama', 'Thriller'],['Adventure', 'Family', 'Fantasy'],['Action', 'Adventure'],['Action', 'Adventure', 'Romance'],['Adventure', 'Family', 'Fantasy'],['Crime', 'Drama'],['Comedy', 'Horror'],['Comedy', 'Fantasy', 'Romance'],['Drama'],['Drama'],['Comedy', 'Drama'],['Comedy', 'Drama', 'Romance'],['Adventure', 'Sci-Fi', 'Thriller'],['Action', 'Adventure', 'Fantasy'],['Comedy', 'Drama'],['Biography', 'Drama', 'Romance'],['Comedy', 'Fantasy'],['Comedy', 'Drama', 'Fantasy'],['Comedy'],['Horror', 'Thriller'],['Action', 'Adventure', 'Sci-Fi'],['Adventure', 'Comedy', 'Horror'],['Comedy', 'Mystery'],['Drama'],['Adventure', 'Drama', 'Fantasy'],['Drama', 'Sport'],['Action', 'Adventure'],['Action', 'Adventure', 'Drama'],['Action', 'Drama', 'Sci-Fi'],['Action', 'Mystery', 'Sci-Fi'],['Action', 'Crime', 'Drama'],['Action', 'Crime', 'Fantasy'],['Biography', 'Comedy', 'Drama'],['Action', 'Crime', 'Thriller'],['Biography', 'Crime', 'Drama'],['Drama', 'Sport'],['Adventure', 'Comedy', 'Drama'],['Action', 'Adventure', 'Thriller'],['Comedy', 'Fantasy', 'Horror'],['Drama', 'Sport'],['Horror', 'Thriller'],['Drama', 'History', 'Thriller'],['Animation', 'Action', 'Adventure'],['Action', 'Adventure', 'Drama'],['Action', 'Comedy', 'Family'],['Action', 'Adventure', 'Drama'],['Action', 'Adventure', 'Sci-Fi'],['Action', 'Adventure', 'Sci-Fi'],['Action', 'Comedy'],['Action', 'Crime', 'Drama'],['Biography', 'Drama'],['Comedy', 'Romance'],['Comedy'],['Drama', 'Fantasy', 'Romance'],['Action', 'Adventure', 'Sci-Fi'],['Comedy'],['Comedy', 'Sci-Fi'],['Comedy', 'Drama'],['Animation', 'Action', 'Adventure'],['Horror'],['Action', 'Biography', 'Crime'],['Animation', 'Adventure', 'Comedy'],['Drama', 'Romance'],['Drama', 'Mystery', 'Thriller'],['Drama', 'History', 'Thriller'],['Animation', 'Adventure', 'Comedy'],['Action', 'Adventure', 'Sci-Fi'],['Adventure', 'Comedy'],['Action', 'Thriller'],['Comedy', 'Music'],['Animation', 'Adventure', 'Comedy'],['Crime', 'Drama', 'Thriller'],['Action', 'Adventure', 'Crime'],['Comedy', 'Drama', 'Horror'],['Drama'],['Drama', 'Mystery', 'Romance'],['Adventure', 'Family', 'Fantasy'],['Drama'],['Action', 'Drama', 'Thriller'],['Drama'],['Action', 'Horror', 'Romance'],['Action', 'Drama', 'Fantasy'],['Action', 'Crime', 'Drama'],['Drama', 'Fantasy', 'Romance'],['Action', 'Crime', 'Thriller'],['Action', 'Mystery', 'Thriller'],['Horror', 'Mystery', 'Thriller'],['Action', 'Horror', 'Sci-Fi'],['Comedy', 'Drama'],['Comedy'],['Action', 'Adventure', 'Horror'],['Action', 'Adventure', 'Thriller'],['Action', 'Crime', 'Drama'],['Comedy', 'Crime', 'Drama'],['Drama', 'Romance'],['Drama', 'Thriller'],['Action', 'Comedy', 'Crime'],['Comedy'],['Adventure', 'Family', 'Fantasy'],['Drama', 'Romance'],['Animation', 'Family', 'Fantasy'],['Drama', 'Romance'],['Thriller'],['Adventure', 'Horror', 'Mystery'],['Action', 'Sci-Fi'],['Adventure', 'Comedy', 'Drama'],['Animation', 'Action', 'Adventure'],['Drama', 'Horror'],['Action', 'Adventure', 'Sci-Fi'],['Comedy', 'Drama'],['Action', 'Horror', 'Mystery'],['Action', 'Thriller'],['Action', 'Adventure', 'Sci-Fi'],['Drama'],['Comedy', 'Drama', 'Romance'],['Comedy', 'Crime'],['Comedy', 'Romance'],['Drama', 'Romance'],['Crime', 'Drama', 'Thriller'],['Horror', 'Mystery', 'Thriller'],['Biography', 'Drama'],['Drama', 'Mystery', 'Sci-Fi'],['Adventure', 'Comedy', 'Family'],['Action', 'Adventure', 'Crime'],['Action', 'Crime', 'Mystery'],['Mystery', 'Thriller'],['Action', 'Sci-Fi', 'Thriller'],['Action', 'Comedy', 'Crime'],['Biography', 'Crime', 'Drama'],['Biography', 'Drama', 'History'],['Action', 'Adventure', 'Sci-Fi'],['Adventure', 'Family', 'Fantasy'],['Biography', 'Drama', 'History'],['Biography', 'Comedy', 'Drama'],['Drama', 'Thriller'],['Horror', 'Thriller'],['Drama'],['Drama', 'War'],['Comedy', 'Drama', 'Romance'],['Drama', 'Romance', 'Sci-Fi'],['Action', 'Crime', 'Drama'],['Comedy', 'Drama'],['Animation', 'Action', 'Adventure'],['Adventure', 'Comedy', 'Drama'],['Comedy', 'Drama', 'Family'],['Drama', 'Romance', 'Thriller'],['Comedy', 'Crime', 'Drama'],['Animation', 'Comedy', 'Family'],['Drama', 'Horror', 'Sci-Fi'],['Action', 'Adventure', 'Drama'],['Action', 'Horror', 'Sci-Fi'],['Action', 'Crime', 'Sport'],['Drama', 'Horror', 'Sci-Fi'],['Drama', 'Horror', 'Sci-Fi'],['Action', 'Adventure', 'Comedy'],['Mystery', 'Sci-Fi', 'Thriller'],['Crime', 'Drama', 'Thriller'],['Animation', 'Adventure', 'Comedy'],['Action', 'Sci-Fi', 'Thriller'],['Drama', 'Romance'],['Crime', 'Drama', 'Thriller'],['Comedy', 'Drama', 'Music'],['Drama', 'Fantasy', 'Romance'],['Crime', 'Drama', 'Thriller'],['Crime', 'Drama', 'Thriller'],['Comedy', 'Drama', 'Romance'],['Comedy', 'Romance'],['Drama', 'Sci-Fi', 'Thriller'],['Drama', 'War'],['Action', 'Crime', 'Drama'],['Sci-Fi', 'Thriller'],['Adventure', 'Drama', 'Horror'],['Comedy', 'Drama', 'Music'],['Comedy', 'Drama', 'Romance'],['Action', 'Adventure', 'Drama'],['Action', 'Crime', 'Drama'],['Adventure', 'Fantasy'],['Drama', 'Romance'],['Biography', 'History', 'Thriller'],['Crime', 'Drama', 'Thriller'],['Action', 'Drama', 'History'],['Biography', 'Comedy', 'Drama'],['Crime', 'Drama', 'Thriller'],['Action', 'Biography', 'Drama'],['Action', 'Drama', 'Sci-Fi'],['Adventure', 'Horror'],['Action', 'Adventure', 'Sci-Fi'],['Action', 'Adventure', 'Mystery'],['Comedy', 'Drama', 'Romance'],['Horror', 'Thriller'],['Action', 'Sci-Fi', 'Thriller'],['Action', 'Sci-Fi', 'Thriller'],['Biography', 'Drama'],['Action', 'Crime', 'Drama'],['Action', 'Crime', 'Mystery'],['Action', 'Adventure', 'Comedy'],['Crime', 'Drama', 'Thriller'],['Crime', 'Drama'],['Mystery', 'Thriller'],['Mystery', 'Sci-Fi', 'Thriller'],['Action', 'Mystery', 'Sci-Fi'],['Drama', 'Romance'],['Drama', 'Thriller'],['Drama', 'Mystery', 'Sci-Fi'],['Comedy', 'Drama'],['Adventure', 'Family', 'Fantasy'],['Biography', 'Drama', 'Sport'],['Drama'],['Comedy', 'Drama', 'Romance'],['Biography', 'Drama', 'Romance'],['Action', 'Adventure', 'Sci-Fi'],['Drama', 'Sci-Fi', 'Thriller'],['Drama', 'Romance', 'Thriller'],['Mystery', 'Thriller'],['Mystery', 'Thriller'],['Action', 'Drama', 'Fantasy'],['Action', 'Adventure', 'Biography'],['Adventure', 'Comedy', 'Sci-Fi'],['Action', 'Adventure', 'Thriller'],['Fantasy', 'Horror'],['Horror', 'Mystery'],['Animation', 'Adventure', 'Comedy'],['Action', 'Adventure', 'Drama'],['Adventure', 'Family', 'Fantasy'],['Action', 'Adventure', 'Sci-Fi'],['Comedy', 'Drama'],['Comedy', 'Drama'],['Crime', 'Drama', 'Thriller'],['Comedy', 'Romance'],['Animation', 'Comedy', 'Family'],['Comedy', 'Drama'],['Comedy', 'Drama'],['Biography', 'Drama', 'Sport'],['Action', 'Adventure', 'Fantasy'],['Action', 'Drama', 'History'],['Action', 'Adventure', 'Sci-Fi'],['Action', 'Adventure', 'Mystery'],['Crime', 'Drama', 'Mystery'],['Action'],['Action', 'Adventure', 'Family'],['Comedy', 'Romance'],['Comedy', 'Drama', 'Romance'],['Biography', 'Drama', 'Sport'],['Action', 'Fantasy', 'Thriller'],['Biography', 'Drama', 'Sport'],['Action', 'Drama', 'Fantasy'],['Adventure', 'Sci-Fi', 'Thriller'],['Animation', 'Adventure', 'Comedy'],['Drama', 'Mystery', 'Thriller'],['Drama', 'Romance'],['Crime', 'Drama', 'Mystery'],['Comedy', 'Romance', 'Sport'],['Comedy', 'Family'],['Drama', 'Horror', 'Mystery'],['Action', 'Drama', 'Sport'],['Action', 'Adventure', 'Comedy'],['Drama', 'Mystery', 'Sci-Fi'],['Animation', 'Action', 'Comedy'],['Action', 'Crime', 'Drama'],['Action', 'Crime', 'Drama'],['Comedy', 'Drama', 'Romance'],['Animation', 'Action', 'Adventure'],['Crime', 'Drama'],['Drama'],['Drama'],['Comedy', 'Crime'],['Drama'],['Action', 'Adventure', 'Fantasy'],['Drama', 'Fantasy', 'Romance'],['Comedy', 'Drama'],['Drama', 'Fantasy', 'Thriller'],['Biography', 'Crime', 'Drama'],['Comedy', 'Drama', 'Romance'],['Action', 'Crime', 'Drama'],['Sci-Fi'],['Action', 'Biography', 'Drama'],['Action', 'Comedy', 'Romance'],['Adventure', 'Comedy', 'Drama'],['Comedy', 'Crime', 'Drama'],['Action', 'Fantasy', 'Horror'],['Drama', 'Horror'],['Horror'],['Action', 'Thriller'],['Action', 'Adventure', 'Mystery'],['Action', 'Adventure', 'Fantasy'],['Comedy', 'Drama', 'Romance'],['Crime', 'Drama', 'Mystery'],['Adventure', 'Comedy', 'Family'],['Comedy', 'Drama', 'Romance'],['Comedy'],['Comedy', 'Drama', 'Horror'],['Drama', 'Horror', 'Thriller'],['Animation', 'Adventure', 'Family'],['Comedy', 'Romance'],['Mystery', 'Romance', 'Sci-Fi'],['Crime', 'Drama'],['Drama', 'Horror', 'Mystery'],['Comedy'],['Biography', 'Drama'],['Comedy', 'Drama', 'Thriller'],['Comedy', 'Western'],['Drama', 'History', 'War'],['Drama', 'Horror', 'Sci-Fi'],['Drama'],['Comedy', 'Drama'],['Fantasy', 'Horror', 'Thriller'],['Drama', 'Romance'],['Action', 'Comedy', 'Fantasy'],['Drama', 'Horror', 'Musical'],['Crime', 'Drama', 'Mystery'],['Horror', 'Mystery', 'Thriller'],['Comedy', 'Music'],['Drama'],['Biography', 'Crime', 'Drama'],['Drama'],['Action', 'Adventure', 'Comedy'],['Crime', 'Drama', 'Mystery'],['Drama'],['Action', 'Comedy', 'Crime'],['Comedy', 'Drama', 'Romance'],['Crime', 'Drama', 'Mystery'],['Action', 'Comedy', 'Crime'],['Drama'],['Drama', 'Romance'],['Crime', 'Drama', 'Mystery'],['Adventure', 'Comedy', 'Romance'],['Comedy', 'Crime', 'Drama'],['Adventure', 'Drama', 'Thriller'],['Biography', 'Crime', 'Drama'],['Crime', 'Drama', 'Thriller'],['Drama', 'History', 'Thriller'],['Action', 'Adventure', 'Sci-Fi'],['Action', 'Comedy'],['Horror'],['Action', 'Crime', 'Mystery'],['Comedy', 'Romance'],['Comedy'],['Action', 'Drama', 'Thriller'],['Action', 'Adventure', 'Sci-Fi'],['Drama', 'Mystery', 'Thriller'],['Comedy', 'Drama', 'Romance'],['Action', 'Fantasy', 'Horror'],['Drama', 'Romance'],['Biography', 'Drama'],['Biography', 'Drama'],['Action', 'Adventure', 'Sci-Fi'],['Animation', 'Adventure', 'Comedy'],['Drama', 'Mystery', 'Thriller'],['Action', 'Horror', 'Sci-Fi'],['Drama', 'Romance'],['Biography', 'Drama'],['Action', 'Adventure', 'Drama'],['Adventure', 'Drama', 'Fantasy'],['Drama', 'Family'],['Comedy', 'Drama', 'Romance'],['Drama', 'Romance', 'Sci-Fi'],['Action', 'Adventure', 'Thriller'],['Comedy', 'Romance'],['Crime', 'Drama', 'Horror'],['Comedy', 'Fantasy'],['Action', 'Comedy', 'Crime'],['Adventure', 'Drama', 'Romance'],['Action', 'Crime', 'Drama'],['Crime', 'Horror', 'Thriller'],['Romance', 'Sci-Fi', 'Thriller'],['Comedy', 'Drama', 'Romance'],['Crime', 'Drama'],['Crime', 'Drama', 'Mystery'],['Action', 'Adventure', 'Sci-Fi'],['Animation', 'Fantasy'],['Animation', 'Adventure', 'Comedy'],['Drama', 'Mystery', 'War'],['Comedy', 'Romance'],['Animation', 'Comedy', 'Family'],['Comedy'],['Horror', 'Mystery', 'Thriller'],['Action', 'Adventure', 'Drama'],['Comedy'],['Drama'],['Adventure', 'Biography', 'Drama'],['Comedy'],['Horror', 'Thriller'],['Action', 'Drama', 'Family'],['Comedy', 'Fantasy', 'Horror'],['Comedy', 'Romance'],['Drama', 'Mystery', 'Romance'],['Action', 'Adventure', 'Comedy'],['Thriller'],['Comedy'],['Adventure', 'Comedy', 'Sci-Fi'],['Comedy', 'Drama', 'Fantasy'],['Mystery', 'Thriller'],['Comedy', 'Drama'],['Adventure', 'Drama', 'Family'],['Horror', 'Thriller'],['Action', 'Drama', 'Romance'],['Drama', 'Romance'],['Action', 'Adventure', 'Fantasy'],['Comedy'],['Action', 'Biography', 'Drama'],['Drama', 'Mystery', 'Romance'],['Adventure', 'Drama', 'Western'],['Drama', 'Music', 'Romance'],['Comedy', 'Romance', 'Western'],['Thriller'],['Comedy', 'Drama', 'Romance'],['Horror', 'Thriller'],['Adventure', 'Family', 'Fantasy'],['Crime', 'Drama', 'Mystery'],['Horror', 'Mystery'],['Comedy', 'Crime', 'Drama'],['Action', 'Comedy', 'Romance'],['Biography', 'Drama', 'History'],['Adventure', 'Drama'],['Drama', 'Thriller'],['Drama'],['Action', 'Adventure', 'Fantasy'],['Action', 'Biography', 'Drama'],['Drama', 'Music'],['Comedy', 'Drama'],['Drama', 'Thriller', 'War'],['Action', 'Mystery', 'Thriller'],['Horror', 'Sci-Fi', 'Thriller'],['Comedy', 'Drama', 'Romance'],['Action', 'Sci-Fi'],['Action', 'Adventure', 'Fantasy'],['Drama', 'Mystery', 'Romance'],['Drama'],['Action', 'Adventure', 'Thriller'],['Action', 'Crime', 'Thriller'],['Animation', 'Action', 'Adventure'],['Drama', 'Fantasy', 'Mystery'],['Drama', 'Sci-Fi'],['Animation', 'Adventure', 'Comedy'],['Horror', 'Thriller'],['Action', 'Thriller'],['Comedy'],['Biography', 'Drama'],['Action', 'Mystery', 'Thriller'],['Action', 'Mystery', 'Sci-Fi'],['Crime', 'Drama', 'Thriller'],['Comedy', 'Romance'],['Comedy', 'Drama', 'Romance'],['Biography', 'Drama', 'Thriller'],['Drama'],['Action', 'Adventure', 'Family'],['Animation', 'Comedy', 'Family'],['Action', 'Crime', 'Drama'],['Comedy'],['Comedy', 'Crime', 'Thriller'],['Comedy', 'Romance'],['Animation', 'Comedy', 'Drama'],['Action', 'Crime', 'Thriller'],['Comedy', 'Romance'],['Adventure', 'Biography', 'Drama'],['Animation', 'Adventure', 'Comedy'],['Crime', 'Drama', 'Mystery'],['Action', 'Comedy', 'Sci-Fi'],['Comedy', 'Fantasy', 'Horror'],['Comedy', 'Crime'],['Animation', 'Action', 'Adventure'],['Action', 'Drama', 'Thriller'],['Fantasy', 'Horror'],['Crime', 'Drama', 'Thriller'],['Action', 'Adventure', 'Fantasy'],['Comedy', 'Drama', 'Romance'],['Biography', 'Drama', 'Romance'],['Action', 'Drama', 'History'],['Action', 'Adventure', 'Comedy'],['Horror', 'Thriller'],['Horror', 'Mystery', 'Thriller'],['Comedy', 'Romance'],['Animation', 'Adventure', 'Comedy'],['Crime', 'Drama', 'Mystery'],['Crime', 'Drama', 'Mystery'],['Adventure', 'Biography', 'Drama'],['Horror', 'Mystery', 'Thriller'],['Horror', 'Thriller'],['Drama', 'Romance', 'War'],['Adventure', 'Fantasy', 'Mystery'],['Action', 'Adventure', 'Sci-Fi'],['Biography', 'Drama'],['Drama', 'Thriller'],['Horror', 'Thriller'],['Drama', 'Horror', 'Thriller'],['Action', 'Adventure', 'Fantasy'],['Action', 'Horror', 'Thriller'],['Comedy'],['Drama', 'Sport'],['Comedy', 'Family'],['Drama', 'Romance'],['Action', 'Adventure', 'Comedy'],['Comedy'],['Mystery', 'Romance', 'Thriller'],['Crime', 'Drama'],['Action', 'Comedy'],['Crime', 'Drama', 'Mystery'],['Biography', 'Drama', 'Romance'],['Comedy', 'Crime'],['Drama', 'Thriller'],['Drama'],['Animation', 'Adventure', 'Comedy'],['Action', 'Thriller'],['Drama', 'Thriller'],['Animation', 'Adventure', 'Comedy'],['Crime', 'Drama', 'Mystery'],['Thriller'],['Biography', 'Drama', 'Sport'],['Crime', 'Drama', 'Thriller'],['Drama', 'Music'],['Crime', 'Drama', 'Thriller'],['Drama', 'Romance'],['Animation', 'Action', 'Adventure'],['Comedy', 'Drama'],['Action', 'Adventure', 'Drama'],['Biography', 'Crime', 'Drama'],['Horror'],['Biography', 'Drama', 'Mystery'],['Drama', 'Romance'],['Animation', 'Drama', 'Romance'],['Comedy', 'Family'],['Drama'],['Mystery', 'Thriller'],['Drama', 'Fantasy', 'Horror'],['Drama', 'Romance'],['Biography', 'Drama', 'History'],['Comedy', 'Family'],['Action', 'Adventure', 'Thriller'],['Comedy', 'Drama'],['Action', 'Adventure', 'Fantasy'],['Action', 'Thriller'],['Drama', 'Romance'],['Comedy', 'Drama', 'Romance'],['Drama', 'Horror', 'Sci-Fi'],['Comedy', 'Horror', 'Romance'],['Drama'],['Action', 'Adventure', 'Sci-Fi'],['Action', 'Adventure', 'Fantasy'],['Action', 'Adventure', 'Drama'],['Biography', 'Comedy', 'Drama'],['Drama', 'Mystery', 'Romance'],['Animation', 'Adventure', 'Comedy'],['Drama', 'Romance', 'Sci-Fi'],['Drama'],['Drama', 'Fantasy'],['Drama', 'Romance'],['Comedy', 'Horror', 'Thriller'],['Comedy', 'Drama', 'Romance'],['Crime', 'Drama'],['Comedy', 'Romance'],['Action', 'Drama', 'Family'],['Comedy', 'Drama', 'Romance'],['Action', 'Thriller', 'War'],['Action', 'Comedy', 'Horror'],['Biography', 'Drama', 'Sport'],['Adventure', 'Comedy', 'Drama'],['Comedy', 'Romance'],['Comedy', 'Romance'],['Comedy', 'Drama', 'Romance'],['Action', 'Adventure', 'Crime'],['Comedy', 'Romance'],['Animation', 'Action', 'Adventure'],['Action', 'Crime', 'Sci-Fi'],['Drama'],['Comedy', 'Drama', 'Romance'],['Crime', 'Thriller'],['Comedy', 'Horror', 'Sci-Fi'],['Drama', 'Thriller'],['Drama', 'Fantasy', 'Horror'],['Thriller'],['Adventure', 'Drama', 'Family'],['Mystery', 'Sci-Fi', 'Thriller'],['Biography', 'Crime', 'Drama'],['Drama', 'Fantasy', 'Horror'],['Action', 'Adventure', 'Thriller'],['Crime', 'Drama', 'Horror'],['Crime', 'Drama', 'Fantasy'],['Adventure', 'Family', 'Fantasy'],['Action', 'Adventure', 'Drama'],['Action', 'Comedy', 'Horror'],['Comedy', 'Drama', 'Family'],['Action', 'Thriller'],['Action', 'Adventure', 'Sci-Fi'],['Adventure', 'Drama', 'Fantasy'],['Drama'],['Drama'],['Comedy'],['Drama'],['Comedy', 'Drama', 'Music'],['Drama', 'Fantasy', 'Music'],['Drama'],['Thriller'],['Comedy', 'Horror'],['Action', 'Comedy', 'Sport'],['Horror'],['Comedy', 'Drama'],['Action', 'Drama', 'Thriller'],['Drama', 'Romance'],['Horror', 'Mystery'],['Adventure', 'Drama', 'Fantasy'],['Thriller'],['Comedy', 'Romance'],['Action', 'Sci-Fi', 'Thriller'],['Fantasy', 'Mystery', 'Thriller'],['Biography', 'Drama'],['Crime', 'Drama'],['Action', 'Adventure', 'Sci-Fi'],['Adventure'],['Comedy', 'Drama'],['Comedy', 'Drama'],['Comedy', 'Drama', 'Romance'],['Adventure', 'Comedy', 'Drama'],['Action', 'Sci-Fi', 'Thriller'],['Comedy', 'Romance'],['Action', 'Fantasy', 'Horror'],['Crime', 'Drama', 'Thriller'],['Action', 'Drama', 'Thriller'],['Crime', 'Drama', 'Mystery'],['Crime', 'Drama', 'Mystery'],['Drama', 'Sci-Fi', 'Thriller'],['Biography', 'Drama', 'History'],['Crime', 'Horror', 'Thriller'],['Drama'],['Drama', 'Mystery', 'Thriller'],['Adventure', 'Biography'],['Adventure', 'Biography', 'Crime'],['Action', 'Horror', 'Thriller'],['Action', 'Adventure', 'Western'],['Horror', 'Thriller'],['Drama', 'Mystery', 'Thriller'],['Comedy', 'Drama', 'Musical'],['Horror', 'Mystery'],['Biography', 'Drama', 'Sport'],['Comedy', 'Family', 'Romance'],['Drama', 'Mystery', 'Thriller'],['Comedy'],['Drama'],['Drama', 'Thriller'],['Biography', 'Drama', 'Family'],['Comedy', 'Drama', 'Family'],['Drama', 'Fantasy', 'Musical'],['Comedy'],['Adventure', 'Family'],['Adventure', 'Comedy', 'Fantasy'],['Horror', 'Thriller'],['Drama', 'Romance'],['Horror'],['Biography', 'Drama', 'History'],['Action', 'Adventure', 'Fantasy'],['Drama', 'Family', 'Music'],['Comedy', 'Drama', 'Romance'],['Action', 'Adventure', 'Horror'],['Comedy'],['Crime', 'Drama', 'Mystery'],['Horror'],['Drama', 'Music', 'Romance'],['Adventure', 'Comedy'],['Comedy', 'Family', 'Fantasy']]genre_list=[j for i in class_list for j in i]# 去重
genre=np.unique(genre_list)
genrearray(['Action', 'Adventure', 'Animation', 'Biography', 'Comedy', 'Crime','Drama', 'Family', 'Fantasy', 'History', 'Horror', 'Music','Musical', 'Mystery', 'Romance', 'Sci-Fi', 'Sport', 'Thriller','War', 'Western'], dtype='<U9')# 创建一个用于统计电影类别的空的dataframegenre_type=pd.DataFrame(np.zeros((1000,len(genre)),dtype=np.int32), columns=genre)
genre_type.head()
Action | Adventure | Animation | Biography | Comedy | Crime | Drama | Family | Fantasy | History | Horror | Music | Musical | Mystery | Romance | Sci-Fi | Sport | Thriller | War | Western | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
for i in range(1000):genre_type.loc[i,class_list[i]]=1genre_type.head()
Action | Adventure | Animation | Biography | Comedy | Crime | Drama | Family | Fantasy | History | Horror | Music | Musical | Mystery | Romance | Sci-Fi | Sport | Thriller | War | Western | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 |
2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
3 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
4 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
genre_type.sum(axis=0).sort_values(ascending=False). plot(kind="bar",figsize=(20,8),fontsize=30,colormap="cool")<matplotlib.axes._subplots.AxesSubplot at 0x7f8cd01176a0>
4. pandas使用2相关推荐
- Pandas 使用入门
Pandas 简介 运行环境 jupyter notebook python 3.6 pandas '0.20.3' matplotlib '2.1.0' 学习目标: * 大致了解 pandas 库的 ...
- modin pandas 加速
20211203 https://blog.csdn.net/BF02jgtRS00XKtCx/article/details/108988757 利用swifter加速apply Modin是一个P ...
- 利用pandas读写HDF5文件
一.简介 HDF5(Hierarchical Data Formal)是用于存储大规模数值数据的较为理想的存储格式,文件后缀名为h5,存储读取速度非常快,且可在文件内部按照明确的层次存储数据,同一个H ...
- pandas dataframe 删除带空值的行 各种空值 (dropna()、isna()、isnull()、fillna())
假设拿到一个10万行的数据后,通过isnull我们发现某列有几个空值,要把该列空值所在行删除怎么操作?用dropna()会删除所有有空值的行,请看下面实例. 区分 None,null,NULL,nan ...
- pandas以前笔记
# -*- coding: utf-8 -*- """ Created on Sat Jul 21 20:06:20 2018@author: heimi "& ...
- pandas dataframe 字符映射为数字
在机器学习中对于有序的类别型变量可以不采用onehot编码,直接使用有序数字代替即可,这个目的可以在pandas中使用map方法实现. import pandas as pd 创建数据框 raw_da ...
- pandas如何读取一个文件夹下的所有文件
from os import walk import pandas as pd dataframe_list = [] #walk会返回3个参数,分别是路径,目录list,文件list,你可以按需修改 ...
- python pandas 如何找到NaN、缺失值或者某些元素的索引名称以及位置,np.where的使用
我们在处理数据的时候,经常需要检查数据的质量,也需要知道出问题的数据在哪个位置.我找了很久,也尝试了很多办法,都没能找到一种非常直接的函数,本文所要介绍的是一种我认为比较方便的方法:np.where( ...
- pandas数据框,统计某列或者某行数据元素的个数
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/sinat_38893241/artic ...
- Pandas库常用函数和操作
目录 1. DataFrame 处理缺失值 dropna() 2. 根据某维度计算重复的行 duplicated().value_counts() 3. 去重 drop_duplicates( ...
最新文章
- 程序员如何面试才能拿到offer
- spark sql读取hive底层_[大数据]spark sql读写Hive数据不一致
- 大数据各组件环境完整安装
- SQL十进制和十六进制相互转换
- android gradle abi mips x86,APP_ABI := armeabi armeabi-v7a mips x86与= armeabi armeabi-v7a区别是?...
- maxon电机中文名_MAXON电机完全手册(全系列).pdf
- 计算机教师所需技能,信息技术教师应具备哪些教学技能
- javaFx(7)文本阅读器
- RRStudio(一)
- Philosopher’s Walk ICPC 2017 Daejeon F dfs 分治
- 五一培训 清北学堂 DAY3
- ThinkPad 连接无线网络几分钟后无线自动关闭
- Linux 常用命令 — 修改密码
- 微信订阅号通过获取Openid并获取用户基本信息
- python安装虚拟环境没有activate_python安装虚拟环境
- 基于SpringCloud分布式微服务+微信小程序实现短视频社交app设计
- 让按钮变灰色,不可用/
- OllyDBG 破解入门教程
- WinEdt的Ctex运行错误解决方案
- Charles打开后,Pc电脑端浏览器展示空白页面,无法正常使用or浏览网页