{
  "id": 437616,
  "title": "How to handle such large dataset ? ",
  "url": "/competitions/child-mind-institute-detect-sleep-states/discussion/437616",
  "author_name": "Dietzsche Nostoevsky",
  "post_date": "2023-09-07T14:04:49.629000",
  "votes": 8,
  "comment_count": 19,
  "views": 0,
  "content": "<p>My PC could't handle the parquet file due to memory limitations, so I tried Kaggle notebook. And even 30GB of RAM is just enough to pd.read_parquet(). <br>\nI converted the parquet file to CSV file and the resulting file is 8GB. <br>\nHave to resort to file handlers just to count rows. The train dataset is 127,946,341 rows. </p>\n<p>How should I handle 128 million rows ?  Can't even do summary statistics rn</p>",
  "messages": [
    {
      "id": 2431244,
      "postDate": "2023-09-09T23:56:21.280Z",
      "content": "<p>I haven't tried it yet, so just sharing an idea (something that might be a solution). If its helpful then im happy, so please share if it works.</p>\n<ul>\n<li><p>In past competitions(<a href=\"https://www.kaggle.com/competitions/predict-student-performance-from-game-play\" target=\"_blank\">PSP</a>), the amount of training data was large, so we had to carefully manage memory. I'm planning to try <a href=\"https://www.kaggle.com/code/gusthema/student-performance-w-tensorflow-decision-forests\" target=\"_blank\">this</a> one out.</p></li>\n<li><p>Watch the great Chris <a href=\"https://www.kaggle.com/cdeotte\" target=\"_blank\">@cdeotte</a> discussion</p></li>\n</ul>\n<ol>\n<li><a href=\"https://www.kaggle.com/competitions/amex-default-prediction/discussion/328054\" target=\"_blank\">How To Reduce Data Size</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/h-and-m-personalized-fashion-recommendations/discussion/308635\" target=\"_blank\">Memory Trick - Reduce Memory 8x or 16x!</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/predict-student-performance-from-game-play/discussion/396979\" target=\"_blank\">How To Get 32GB RAM - Avoid Memory Error!</a></li>\n</ol>",
      "rawMarkdown": "I haven't tried it yet, so just sharing an idea (something that might be a solution). If its helpful then im happy, so please share if it works.\n\n- In past competitions([PSP](https://www.kaggle.com/competitions/predict-student-performance-from-game-play)), the amount of training data was large, so we had to carefully manage memory. I'm planning to try [this](https://www.kaggle.com/code/gusthema/student-performance-w-tensorflow-decision-forests) one out.\n \n- Watch the great Chris @cdeotte discussion\n \n1. [How To Reduce Data Size](https://www.kaggle.com/competitions/amex-default-prediction/discussion/328054)\n2. [Memory Trick - Reduce Memory 8x or 16x!](https://www.kaggle.com/competitions/h-and-m-personalized-fashion-recommendations/discussion/308635)\n3. [How To Get 32GB RAM - Avoid Memory Error!](https://www.kaggle.com/competitions/predict-student-performance-from-game-play/discussion/396979)\n",
      "votes": 7,
      "replies": [
        {
          "id": 2432498,
          "postDate": "2023-09-10T22:34:00.723Z",
          "content": "<p>Hey, I looked at the PSP notebook you provided and saw the pd.read_csv(path, dtype=dtypes) and was wondering if this was possible with pd.read_parquet. It seems like there is no dtype param. I guess I would have to load the parquet and then set the dtypes, but that removes a lot of the utility that loading in a reduced memory dataset would have.</p>",
          "rawMarkdown": "Hey, I looked at the PSP notebook you provided and saw the pd.read_csv(path, dtype=dtypes) and was wondering if this was possible with pd.read_parquet. It seems like there is no dtype param. I guess I would have to load the parquet and then set the dtypes, but that removes a lot of the utility that loading in a reduced memory dataset would have.",
          "votes": 1,
          "replies": [
            {
              "id": 2432506,
              "postDate": "2023-09-10T22:54:45.683Z",
              "content": "<p><a href=\"https://www.kaggle.com/aleksanderklimczyk\" target=\"_blank\">@aleksanderklimczyk</a> Yes. These are examples of a csv file. <a href=\"https://www.kaggle.com/code/andradaolteanu/zzz-good-night-sleep-with-80-memory-reduction\" target=\"_blank\">The memory reduction notes</a> by <a href=\"https://www.kaggle.com/andradaolteanu\" target=\"_blank\">@andradaolteanu</a> will be helpful for this competition.</p>",
              "rawMarkdown": "@aleksanderklimczyk Yes. These are examples of a csv file. [The memory reduction notes](https://www.kaggle.com/code/andradaolteanu/zzz-good-night-sleep-with-80-memory-reduction) by @andradaolteanu will be helpful for this competition.",
              "votes": 2
            }
          ]
        }
      ]
    },
    {
      "id": 2427854,
      "postDate": "2023-09-07T14:04:49.630Z",
      "content": "<p>My PC could't handle the parquet file due to memory limitations, so I tried Kaggle notebook. And even 30GB of RAM is just enough to pd.read_parquet(). <br>\nI converted the parquet file to CSV file and the resulting file is 8GB. <br>\nHave to resort to file handlers just to count rows. The train dataset is 127,946,341 rows. </p>\n<p>How should I handle 128 million rows ?  Can't even do summary statistics rn</p>",
      "rawMarkdown": "My PC could't handle the parquet file due to memory limitations, so I tried Kaggle notebook. And even 30GB of RAM is just enough to pd.read_parquet(). \nI converted the parquet file to CSV file and the resulting file is 8GB. \nHave to resort to file handlers just to count rows. The train dataset is 127,946,341 rows. \n\nHow should I handle 128 million rows ?  Can't even do summary statistics rn",
      "votes": 7
    },
    {
      "id": 2428139,
      "postDate": "2023-09-07T17:02:14.343Z",
      "content": "<p>Consider learning to use the <a href=\"https://www.pola.rs/\" target=\"_blank\">polars</a> package.  There's a little bit of a learning curve but it is a fast, memory efficient tool that is ideal for handling large parquet files.  </p>",
      "rawMarkdown": "Consider learning to use the [polars](https://www.pola.rs/) package.  There's a little bit of a learning curve but it is a fast, memory efficient tool that is ideal for handling large parquet files.  ",
      "votes": 3,
      "replies": [
        {
          "id": 2428468,
          "postDate": "2023-09-07T22:29:29.723Z",
          "content": "<p>It's helpful, but still can be too time-consuming when trying out simple tasks.</p>",
          "rawMarkdown": "It's helpful, but still can be too time-consuming when trying out simple tasks.",
          "votes": 1
        }
      ]
    },
    {
      "id": 2427996,
      "postDate": "2023-09-07T15:32:07.157Z",
      "content": "<p>Dear <a href=\"https://www.kaggle.com/dietzschenostoevsky\" target=\"_blank\">@dietzschenostoevsky</a> </p>\n<p>If it at all helps with getting started I have made a smaller dataset consisting of 13M rows (180M parquet file) which can be found <a href=\"https://www.kaggle.com/datasets/carlmcbrideellis/zzzs-lightweight-training-dataset-target\" target=\"_blank\">here</a>.</p>\n<p>All the best,\ncarl</p>",
      "rawMarkdown": "Dear @dietzschenostoevsky \n\nIf it at all helps with getting started I have made a smaller dataset consisting of 13M rows (180M parquet file) which can be found [here](https://www.kaggle.com/datasets/carlmcbrideellis/zzzs-lightweight-training-dataset-target).\n\nAll the best,\ncarl",
      "votes": 3,
      "replies": [
        {
          "id": 2429965,
          "postDate": "2023-09-09T00:14:47.807Z",
          "content": "<p>Thank you. I will try to see if my machine could handle it. Do you mind sharing how did you created it ? Because I am thinking about upgrading my PC and I am not sure how much RAM I would need to handle such files in future</p>",
          "rawMarkdown": "Thank you. I will try to see if my machine could handle it. Do you mind sharing how did you created it ? Because I am thinking about upgrading my PC and I am not sure how much RAM I would need to handle such files in future",
          "votes": 1,
          "replies": [
            {
              "id": 2430326,
              "postDate": "2023-09-09T08:02:34Z",
              "content": "<p>Dear <a href=\"https://www.kaggle.com/dietzschenostoevsky\" target=\"_blank\">@dietzschenostoevsky</a> </p>\n<p>The notebook to create the dataset is here: <a href=\"https://www.kaggle.com/code/carlmcbrideellis/zzzs-make-clean-starter-dataset-target\" target=\"_blank\">\"Zzzs: Make clean starter dataset + target\"</a>.</p>\n<p>Hope this helps to get started!<br>\ncarl</p>",
              "rawMarkdown": "Dear @dietzschenostoevsky \n\nThe notebook to create the dataset is here: [\"Zzzs: Make clean starter dataset + target\"](https://www.kaggle.com/code/carlmcbrideellis/zzzs-make-clean-starter-dataset-target).\n\nHope this helps to get started!\ncarl",
              "votes": 2
            },
            {
              "id": 2535301,
              "postDate": "2023-11-23T08:27:00.647Z",
              "content": "<p>Your contributions really make sense, many thanks!</p>",
              "rawMarkdown": "Your contributions really make sense, many thanks!"
            }
          ]
        },
        {
          "id": 2430320,
          "postDate": "2023-09-09T07:58:27.980Z",
          "content": "<p>Thanks again for your highly valued contributions. This helps a lot. </p>",
          "rawMarkdown": "Thanks again for your highly valued contributions. This helps a lot. "
        }
      ]
    },
    {
      "id": 2431113,
      "postDate": "2023-09-09T19:38:17.720Z",
      "content": "<p>You can try using dask or dask_cudf for handling the data</p>",
      "rawMarkdown": "You can try using dask or dask_cudf for handling the data\n",
      "votes": 1
    },
    {
      "id": 2430319,
      "postDate": "2023-09-09T07:55:35.957Z",
      "content": "<p>This right here is a key limitation for those of us on a quarter of a shoestring budget. It is really difficult and frustrating to download and properly analyze the entire data to enable full feature engineering in my own case. Oh well, we will keep sampling and extrapolating. Something might stick on the wall eventually. </p>",
      "rawMarkdown": "This right here is a key limitation for those of us on a quarter of a shoestring budget. It is really difficult and frustrating to download and properly analyze the entire data to enable full feature engineering in my own case. Oh well, we will keep sampling and extrapolating. Something might stick on the wall eventually. ",
      "votes": 1
    },
    {
      "id": 2430323,
      "postDate": "2023-09-09T08:00:12.297Z",
      "content": "<p>Has anyone tried brotli compression on the parquet file?</p>\n<p><a href=\"https://stackoverflow.com/questions/33813815/how-to-read-a-parquet-file-into-pandas-dataframe\" target=\"_blank\">https://stackoverflow.com/questions/33813815/how-to-read-a-parquet-file-into-pandas-dataframe</a></p>",
      "rawMarkdown": "Has anyone tried brotli compression on the parquet file?\n\nhttps://stackoverflow.com/questions/33813815/how-to-read-a-parquet-file-into-pandas-dataframe"
    },
    {
      "id": 2429986,
      "postDate": "2023-09-09T01:12:32.200Z",
      "content": "<p>I have found a way to read parquet files a few lines at a time, using <code>pyarrow.parquet</code>. You can see it here:  <a href=\"url\" target=\"_blank\">https://www.kaggle.com/code/nadereafshar/detect-sleep-states/edit</a></p>",
      "rawMarkdown": "I have found a way to read parquet files a few lines at a time, using `pyarrow.parquet`. You can see it here:  [https://www.kaggle.com/code/nadereafshar/detect-sleep-states/edit](url)",
      "replies": [
        {
          "id": 2429992,
          "postDate": "2023-09-09T01:20:20.833Z",
          "content": "<p>The link is not working </p>",
          "rawMarkdown": "The link is not working "
        },
        {
          "id": 2432189,
          "postDate": "2023-09-10T16:48:48.390Z",
          "content": "<p>You can load the data for one series via</p>\n<pre><code>import pyarrow.parquet  pq\n\nseries_id = 'f9e60a8e56d'\n\npq.read]).\n</code></pre>",
          "rawMarkdown": "You can load the data for one series via\n\n```\nimport pyarrow.parquet as pq\n\nseries_id = '0f9e60a8e56d'\n\npq.read_table('train_series.parquet', filters=[('series_id','==',series_id)]).to_pandas()\n```",
          "votes": 2
        }
      ]
    },
    {
      "id": 2427937,
      "postDate": "2023-09-07T14:51:23.037Z",
      "rawMarkdown": "",
      "votes": -8,
      "isDeleted": true,
      "replies": [
        {
          "id": 2429977,
          "postDate": "2023-09-09T00:54:00.603Z",
          "content": "<p>The amount of chatGPT answers these days is overwhelming</p>",
          "rawMarkdown": "The amount of chatGPT answers these days is overwhelming",
          "votes": 5,
          "replies": [
            {
              "id": 2430336,
              "postDate": "2023-09-09T08:11:37.647Z",
              "rawMarkdown": "",
              "votes": -5,
              "isDeleted": true
            }
          ]
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 2431244,
      "author_name": "mh",
      "author_url": "",
      "post_date": "2023-09-09T23:56:21.280000",
      "content": "<p>I haven't tried it yet, so just sharing an idea (something that might be a solution). If its helpful then im happy, so please share if it works.</p>\n<ul>\n<li><p>In past competitions(<a href=\"https://www.kaggle.com/competitions/predict-student-performance-from-game-play\" target=\"_blank\">PSP</a>), the amount of training data was large, so we had to carefully manage memory. I'm planning to try <a href=\"https://www.kaggle.com/code/gusthema/student-performance-w-tensorflow-decision-forests\" target=\"_blank\">this</a> one out.</p></li>\n<li><p>Watch the great Chris <a href=\"https://www.kaggle.com/cdeotte\" target=\"_blank\">@cdeotte</a> discussion</p></li>\n</ul>\n<ol>\n<li><a href=\"https://www.kaggle.com/competitions/amex-default-prediction/discussion/328054\" target=\"_blank\">How To Reduce Data Size</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/h-and-m-personalized-fashion-recommendations/discussion/308635\" target=\"_blank\">Memory Trick - Reduce Memory 8x or 16x!</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/predict-student-performance-from-game-play/discussion/396979\" target=\"_blank\">How To Get 32GB RAM - Avoid Memory Error!</a></li>\n</ol>",
      "votes": 7,
      "replies": [
        {
          "id": 2432498,
          "author_name": "Aleksander Klimczyk",
          "author_url": "",
          "post_date": "2023-09-10T22:34:00.723000",
          "content": "<p>Hey, I looked at the PSP notebook you provided and saw the pd.read_csv(path, dtype=dtypes) and was wondering if this was possible with pd.read_parquet. It seems like there is no dtype param. I guess I would have to load the parquet and then set the dtypes, but that removes a lot of the utility that loading in a reduced memory dataset would have.</p>",
          "votes": 1,
          "replies": [
            {
              "id": 2432506,
              "author_name": "mh",
              "author_url": "",
              "post_date": "2023-09-10T22:54:45.683000",
              "content": "<p><a href=\"https://www.kaggle.com/aleksanderklimczyk\" target=\"_blank\">@aleksanderklimczyk</a> Yes. These are examples of a csv file. <a href=\"https://www.kaggle.com/code/andradaolteanu/zzz-good-night-sleep-with-80-memory-reduction\" target=\"_blank\">The memory reduction notes</a> by <a href=\"https://www.kaggle.com/andradaolteanu\" target=\"_blank\">@andradaolteanu</a> will be helpful for this competition.</p>",
              "votes": 2,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 2428139,
      "author_name": "Quillen",
      "author_url": "",
      "post_date": "2023-09-07T17:02:14.343000",
      "content": "<p>Consider learning to use the <a href=\"https://www.pola.rs/\" target=\"_blank\">polars</a> package.  There's a little bit of a learning curve but it is a fast, memory efficient tool that is ideal for handling large parquet files.  </p>",
      "votes": 3,
      "replies": [
        {
          "id": 2428468,
          "author_name": "Yan Teixeira",
          "author_url": "",
          "post_date": "2023-09-07T22:29:29.723000",
          "content": "<p>It's helpful, but still can be too time-consuming when trying out simple tasks.</p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 2427996,
      "author_name": "Carl McBride Ellis",
      "author_url": "",
      "post_date": "2023-09-07T15:32:07.157000",
      "content": "<p>Dear <a href=\"https://www.kaggle.com/dietzschenostoevsky\" target=\"_blank\">@dietzschenostoevsky</a> </p>\n<p>If it at all helps with getting started I have made a smaller dataset consisting of 13M rows (180M parquet file) which can be found <a href=\"https://www.kaggle.com/datasets/carlmcbrideellis/zzzs-lightweight-training-dataset-target\" target=\"_blank\">here</a>.</p>\n<p>All the best,\ncarl</p>",
      "votes": 3,
      "replies": [
        {
          "id": 2429965,
          "author_name": "Dietzsche Nostoevsky",
          "author_url": "",
          "post_date": "2023-09-09T00:14:47.807000",
          "content": "<p>Thank you. I will try to see if my machine could handle it. Do you mind sharing how did you created it ? Because I am thinking about upgrading my PC and I am not sure how much RAM I would need to handle such files in future</p>",
          "votes": 1,
          "replies": [
            {
              "id": 2430326,
              "author_name": "Carl McBride Ellis",
              "author_url": "",
              "post_date": "2023-09-09T08:02:34",
              "content": "<p>Dear <a href=\"https://www.kaggle.com/dietzschenostoevsky\" target=\"_blank\">@dietzschenostoevsky</a> </p>\n<p>The notebook to create the dataset is here: <a href=\"https://www.kaggle.com/code/carlmcbrideellis/zzzs-make-clean-starter-dataset-target\" target=\"_blank\">\"Zzzs: Make clean starter dataset + target\"</a>.</p>\n<p>Hope this helps to get started!<br>\ncarl</p>",
              "votes": 2,
              "replies": []
            },
            {
              "id": 2535301,
              "author_name": "syx777",
              "author_url": "",
              "post_date": "2023-11-23T08:27:00.647000",
              "content": "<p>Your contributions really make sense, many thanks!</p>",
              "votes": 0,
              "replies": []
            }
          ]
        },
        {
          "id": 2430320,
          "author_name": "AIDLRE001",
          "author_url": "",
          "post_date": "2023-09-09T07:58:27.980000",
          "content": "<p>Thanks again for your highly valued contributions. This helps a lot. </p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 2431113,
      "author_name": "Dan Pietrow",
      "author_url": "",
      "post_date": "2023-09-09T19:38:17.720000",
      "content": "<p>You can try using dask or dask_cudf for handling the data</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 2430319,
      "author_name": "AIDLRE001",
      "author_url": "",
      "post_date": "2023-09-09T07:55:35.957000",
      "content": "<p>This right here is a key limitation for those of us on a quarter of a shoestring budget. It is really difficult and frustrating to download and properly analyze the entire data to enable full feature engineering in my own case. Oh well, we will keep sampling and extrapolating. Something might stick on the wall eventually. </p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 2430323,
      "author_name": "AIDLRE001",
      "author_url": "",
      "post_date": "2023-09-09T08:00:12.297000",
      "content": "<p>Has anyone tried brotli compression on the parquet file?</p>\n<p><a href=\"https://stackoverflow.com/questions/33813815/how-to-read-a-parquet-file-into-pandas-dataframe\" target=\"_blank\">https://stackoverflow.com/questions/33813815/how-to-read-a-parquet-file-into-pandas-dataframe</a></p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 2429986,
      "author_name": "Nader E Afshar",
      "author_url": "",
      "post_date": "2023-09-09T01:12:32.200000",
      "content": "<p>I have found a way to read parquet files a few lines at a time, using <code>pyarrow.parquet</code>. You can see it here:  <a href=\"url\" target=\"_blank\">https://www.kaggle.com/code/nadereafshar/detect-sleep-states/edit</a></p>",
      "votes": 0,
      "replies": [
        {
          "id": 2429992,
          "author_name": "Dietzsche Nostoevsky",
          "author_url": "",
          "post_date": "2023-09-09T01:20:20.833000",
          "content": "<p>The link is not working </p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 2432189,
          "author_name": "eray",
          "author_url": "",
          "post_date": "2023-09-10T16:48:48.390000",
          "content": "<p>You can load the data for one series via</p>\n<pre><code>import pyarrow.parquet  pq\n\nseries_id = 'f9e60a8e56d'\n\npq.read]).\n</code></pre>",
          "votes": 2,
          "replies": []
        }
      ]
    },
    {
      "id": 2427937,
      "author_name": "",
      "author_url": "",
      "post_date": "2023-09-07T14:51:23.037000",
      "content": "",
      "votes": -8,
      "replies": [
        {
          "id": 2429977,
          "author_name": "Yan Teixeira",
          "author_url": "",
          "post_date": "2023-09-09T00:54:00.603000",
          "content": "<p>The amount of chatGPT answers these days is overwhelming</p>",
          "votes": 5,
          "replies": [
            {
              "id": 2430336,
              "author_name": "",
              "author_url": "",
              "post_date": "2023-09-09T08:11:37.647000",
              "content": "",
              "votes": -5,
              "replies": []
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2431244": "I haven't tried it yet, so just sharing an idea (something that might be a solution). If its helpful then im happy, so please share if it works.\n\n- In past competitions([PSP](https://www.kaggle.com/competitions/predict-student-performance-from-game-play)), the amount of training data was large, so we had to carefully manage memory. I'm planning to try [this](https://www.kaggle.com/code/gusthema/student-performance-w-tensorflow-decision-forests) one out.\n \n- Watch the great Chris @cdeotte discussion\n \n1. [How To Reduce Data Size](https://www.kaggle.com/competitions/amex-default-prediction/discussion/328054)\n2. [Memory Trick - Reduce Memory 8x or 16x!](https://www.kaggle.com/competitions/h-and-m-personalized-fashion-recommendations/discussion/308635)\n3. [How To Get 32GB RAM - Avoid Memory Error!](https://www.kaggle.com/competitions/predict-student-performance-from-game-play/discussion/396979)\n",
    "2427854": "My PC could't handle the parquet file due to memory limitations, so I tried Kaggle notebook. And even 30GB of RAM is just enough to pd.read_parquet(). \nI converted the parquet file to CSV file and the resulting file is 8GB. \nHave to resort to file handlers just to count rows. The train dataset is 127,946,341 rows. \n\nHow should I handle 128 million rows ?  Can't even do summary statistics rn",
    "2428139": "Consider learning to use the [polars](https://www.pola.rs/) package.  There's a little bit of a learning curve but it is a fast, memory efficient tool that is ideal for handling large parquet files.  ",
    "2427996": "Dear @dietzschenostoevsky \n\nIf it at all helps with getting started I have made a smaller dataset consisting of 13M rows (180M parquet file) which can be found [here](https://www.kaggle.com/datasets/carlmcbrideellis/zzzs-lightweight-training-dataset-target).\n\nAll the best,\ncarl",
    "2431113": "You can try using dask or dask_cudf for handling the data\n",
    "2430319": "This right here is a key limitation for those of us on a quarter of a shoestring budget. It is really difficult and frustrating to download and properly analyze the entire data to enable full feature engineering in my own case. Oh well, we will keep sampling and extrapolating. Something might stick on the wall eventually. ",
    "2430323": "Has anyone tried brotli compression on the parquet file?\n\nhttps://stackoverflow.com/questions/33813815/how-to-read-a-parquet-file-into-pandas-dataframe",
    "2429986": "I have found a way to read parquet files a few lines at a time, using `pyarrow.parquet`. You can see it here:  [https://www.kaggle.com/code/nadereafshar/detect-sleep-states/edit](url)",
    "2427937": ""
  }
}