{"cells":[{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"5aaa0088-d0cf-6429-1bd2-4750d167ac8a"},"outputs":[],"source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load in \n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n\nfrom subprocess import check_output\nprint(check_output([\"ls\", \"../input\"]).decode(\"utf8\"))\n\n# Any results you write to the current directory are saved as output."},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"80660762-7b78-b9aa-a228-8622e136e9fa"},"outputs":[],"source":"import numpy as np"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"994e65fa-bba6-3842-c97f-24b8d988ef67"},"outputs":[],"source":"import pandas as pd"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"aae631f4-854f-a45d-7b3d-0e519d97e61a"},"outputs":[],"source":"test = pd.read_csv(\"C:\\Users\\1542866\\Downloads\\expedia\\Data\\test.csv\")"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"1a021932-d559-cbc0-9cc3-3be31b2d9550"},"outputs":[],"source":"test =pd.read_csv('C:\\Users\\1542866\\Downloads\\expedia\\Data\\test.csv')"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"58747a16-bb72-0ef4-df2b-4f9b838732ab"},"outputs":[],"source":"test = pd.read_csv(\"C:/Users/1542866/Downloads/expedia/Data/test.csv\")"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"317b1cb0-47d5-8089-e543-783b52070ad9"},"outputs":[],"source":"from subprocess import check_output\nprint(check_output([\"ls\", \"C:/Users/1542866/Downloads/expedia/Data/\"]).decode(\"utf8\"))"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"7114e6a0-ffd5-075b-7862-72201ccdea20"},"outputs":[],"source":"from subprocess import check_output\nprint(check_output([\"ls\", \"../input\"]).decode(\"utf8\"))"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"5d99d09e-4fc5-ce88-7827-6d2468e71e72"},"outputs":[],"source":"train = pd.read_csv('train.csv')"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"40610a45-91a4-7874-135c-3fd579c1cf23"},"outputs":[],"source":"train = pd.read_csv(\"train.csv\")"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"146073fe-79b5-f6c3-229c-5cd6cfe19f54"},"outputs":[],"source":"test = pd.read_csv(\"C:/Users/1542866/Downloads/expedia/Data/test.csv\", chunksize=1000000)"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"2f0883c6-f2da-e7aa-92ab-f32d657f71a1"},"outputs":[],"source":"test=pd.read_csv('C:/Users/1542866/Downloads/expedia/Data/test.csv')"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"1d15af44-fd05-9449-1c5a-c927dd4c184a"},"outputs":[],"source":"test"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"895995ac-5d60-9321-45f2-2dca53409519"},"outputs":[],"source":"test = pd.read_csv(\"C:/Users/1542866/Downloads/expedia/Data/test.csv\", chunksize=1000000)"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"57d12f8d-c0ea-5f89-d048-ba411c031bb5"},"outputs":[],"source":"test=pd.read_csv('C:/Users/1542866/Downloads/expedia/Data/test.csv',header=None)"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"8f90611e-1799-e694-d060-18b983b2c9d9"},"outputs":[],"source":"train = pd.read_csv('../input/train.csv',\n                    dtype={'is_booking':bool,'srch_destination_id':np.int32, 'hotel_cluster':np.int32},\n                    usecols=['srch_destination_id','is_booking','hotel_cluster'],\n                    chunksize=1000000)\naggs = []\nprint('-'*38)\nfor chunk in train:\n    agg = chunk.groupby(['srch_destination_id',\n                         'hotel_cluster'])['is_booking'].agg(['sum','count'])\n    agg.reset_index(inplace=True)\n    aggs.append(agg)\n    print('.',end='')\nprint('')\naggs = pd.concat(aggs, axis=0)\naggs.head()"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"3badd9f3-b768-68e5-45b5-a6e006466474"},"outputs":[],"source":"train = pd.read_csv('../input/train.csv',\n                    dtype={'is_booking':bool,'srch_destination_id':np.int32, 'hotel_cluster':np.int32},\n                    usecols=['srch_destination_id','is_booking','hotel_cluster'],\n                    chunksize=1000000)"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"3d094063-3292-0f22-46c6-a3918e40d7a2"},"outputs":[],"source":"train.head(5)"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"2c14533f-26d1-8b44-e600-f3deef64d541"},"outputs":[],"source":"print(train[1,1])"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"a6dbd63d-0186-4b2c-fa54-fa7ec92603d1"},"outputs":[],"source":"train = pd.read_csv('../input/train.csv',\n                    dtype={'is_booking':bool,'srch_destination_id':np.int32, 'hotel_cluster':np.int32},\n                    usecols=['srch_destination_id','is_booking','hotel_cluster'],\n                    chunksize=1000000)"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"abcf794d-037f-1a5f-f687-04f752c746a9"},"outputs":[],"source":"train.shape"}],"metadata":{"_change_revision":0,"_is_fork":false,"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.6.0"}},"nbformat":4,"nbformat_minor":0}