{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":56537,"databundleVersionId":8015876,"sourceType":"competition"}],"dockerImageVersionId":30702,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"### Features with only one unique value\n\nI insipired myself from [this notebook](https://www.kaggle.com/code/asarvazyan/leap-predict-the-mean). \n\nI the chunking in order to find how many unique values a column has.\n\nHere is an example of a column with only one value (this is not a target column) -- it might  be deleted. It is not the only one.\n","metadata":{}},{"cell_type":"code","source":"import pandas as pd","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"md = {}\ncol = \"pbuf_N2O_50\"\n\nchunksize = 10_000\nfor idx, chunk in enumerate(pd.read_csv(\"/kaggle/input/leap-atmospheric-physics-ai-climsim/train.csv\", chunksize=chunksize)):\n    \n    nbu = chunk[[col]].value_counts()\n    for i in zip(nbu.index, nbu):\n        if i[0][0] not in md.keys():\n            md[i[0][0]] = i[1]\n        else:\n            md[i[0][0]] += i[1]\n    \n    print(\"--------\")\n    print(md)\n    print(idx, end=\" \")\n    if idx > 100:\n        break\n","metadata":{},"execution_count":null,"outputs":[]}]}