{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"!pip install py7zr","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-02-08T08:15:20.344464Z","iopub.execute_input":"2023-02-08T08:15:20.344946Z","iopub.status.idle":"2023-02-08T08:15:35.866298Z","shell.execute_reply.started":"2023-02-08T08:15:20.344843Z","shell.execute_reply":"2023-02-08T08:15:35.865227Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import py7zr\nfrom subprocess import check_output\n\narchive = py7zr.SevenZipFile(\"/kaggle/input/favorita-grocery-sales-forecasting/train.csv.7z\",\n                             mode='r')\narchive.extractall(path=\"/kaggle/working\")\narchive.close()\n\nprint(check_output([\"ls\", \"../working\"]).decode(\"utf8\"))","metadata":{"execution":{"iopub.status.busy":"2023-02-08T08:15:35.868670Z","iopub.execute_input":"2023-02-08T08:15:35.869050Z","iopub.status.idle":"2023-02-08T08:17:09.686903Z","shell.execute_reply.started":"2023-02-08T08:15:35.869014Z","shell.execute_reply":"2023-02-08T08:17:09.685347Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\n\ndtypes = {\"id\": \"uint32\", \"item_nbr\": \"int32\", \"store_nbr\": \"int8\", \"unit_sales\": \"float32\"}\n\nhistory = pd.read_csv(\"train.csv\", usecols=[1, 2, 3, 4, 5], dtype=dtypes,\n                      parse_dates=[\"date\"], skiprows=range(1, 103000000))\nprint(history.shape)\nhistory.head()","metadata":{"execution":{"iopub.status.busy":"2023-02-08T08:17:09.691085Z","iopub.execute_input":"2023-02-08T08:17:09.692294Z","iopub.status.idle":"2023-02-08T08:18:30.407287Z","shell.execute_reply.started":"2023-02-08T08:17:09.692247Z","shell.execute_reply":"2023-02-08T08:18:30.405498Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"history.dtypes","metadata":{"execution":{"iopub.status.busy":"2023-02-08T08:18:30.410796Z","iopub.execute_input":"2023-02-08T08:18:30.411174Z","iopub.status.idle":"2023-02-08T08:18:30.421397Z","shell.execute_reply.started":"2023-02-08T08:18:30.411137Z","shell.execute_reply":"2023-02-08T08:18:30.420088Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"history.to_parquet(\"train.parquet.zip\", index=False)","metadata":{"execution":{"iopub.status.busy":"2023-02-08T08:18:30.422531Z","iopub.execute_input":"2023-02-08T08:18:30.422893Z","iopub.status.idle":"2023-02-08T08:18:33.194559Z","shell.execute_reply.started":"2023-02-08T08:18:30.422862Z","shell.execute_reply":"2023-02-08T08:18:33.193574Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pd.read_parquet(\"train.parquet.zip\")","metadata":{"execution":{"iopub.status.busy":"2023-02-08T08:18:33.196231Z","iopub.execute_input":"2023-02-08T08:18:33.197555Z","iopub.status.idle":"2023-02-08T08:18:34.096858Z","shell.execute_reply.started":"2023-02-08T08:18:33.197507Z","shell.execute_reply":"2023-02-08T08:18:34.095612Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"history.to_parquet(\"train.parquet\", index=False)","metadata":{},"execution_count":null,"outputs":[]}]}