{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.14","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":3004,"databundleVersionId":861823,"sourceType":"competition"}],"dockerImageVersionId":30786,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# Manifold Learning","metadata":{}},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## Exercise 1: Load the data\n\nLoad the `train.csv` and `test.csv` csv files into Pandas storing the columns efficiently using the uint8 data type. Write the files to disk in the `/kaggle/working` directory using the Parquet format. Compare the file size of the original csv files with the size of the created Parquet files. Which is smaller? Why?","metadata":{}},{"cell_type":"code","source":"%%bash\n\nls /kaggle/input/digit-recognizer","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"### Solution","metadata":{}},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\n\n\nTRAIN_DF = pd.read_csv(\n    \"/kaggle/input/digit-recognizer/train.csv\",\n    dtype=np.uint8,\n)\n\nTEST_FEATURES_DF = pd.read_csv(\n    \"/kaggle/input/digit-recognizer/test.csv\",\n    dtype=np.uint8,\n)\n\n_ = TRAIN_DF.to_parquet(\"/kaggle/working/train.parquet\")\n_ = TEST_FEATURES_DF.to_parquet(\"/kaggle/working/test-features.parquet\")\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T06:31:06.873805Z","iopub.execute_input":"2024-11-11T06:31:06.874769Z","iopub.status.idle":"2024-11-11T06:31:13.433062Z","shell.execute_reply.started":"2024-11-11T06:31:06.874699Z","shell.execute_reply":"2024-11-11T06:31:13.431665Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"%%bash\n\nls -lh /kaggle/input/digit-recognizer/*.csv","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T06:34:06.399551Z","iopub.execute_input":"2024-11-11T06:34:06.400580Z","iopub.status.idle":"2024-11-11T06:34:06.418064Z","shell.execute_reply.started":"2024-11-11T06:34:06.400516Z","shell.execute_reply":"2024-11-11T06:34:06.416917Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"%%bash\n\nls -lh /kaggle/working/*.parquet","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T06:33:35.973261Z","iopub.execute_input":"2024-11-11T06:33:35.973720Z","iopub.status.idle":"2024-11-11T06:33:36.001394Z","shell.execute_reply.started":"2024-11-11T06:33:35.973680Z","shell.execute_reply":"2024-11-11T06:33:36.000178Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}