{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "# !pip install datasets\n",
    "\n",
    "from datasets import load_dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "home_values_forecasts\n",
      "new_constructions\n",
      "for_sale_listings\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Downloading data: 100%|██████████| 215M/215M [00:05<00:00, 37.3MB/s] \n",
      "Generating train split: 693661 examples [00:20, 34052.02 examples/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "rentals\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Downloading data: 100%|██████████| 413M/413M [00:12<00:00, 34.2MB/s] \n",
      "Generating train split: 1258740 examples [00:28, 44715.39 examples/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sales\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Downloading data: 100%|██████████| 280M/280M [00:06<00:00, 41.1MB/s] \n",
      "Generating train split: 504608 examples [00:19, 25569.29 examples/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "home_values\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Downloading data: 100%|██████████| 47.3M/47.3M [00:01<00:00, 29.7MB/s]\n",
      "Generating train split: 117912 examples [00:03, 35540.83 examples/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "days_on_market\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Generating train split: 586714 examples [00:16, 34768.33 examples/s]\n"
     ]
    }
   ],
   "source": [
    "configs = [\n",
    "    \"home_values_forecasts\",\n",
    "    \"new_construction\",\n",
    "    \"for_sale_listings\",\n",
    "    \"rentals\",\n",
    "    \"sales\",\n",
    "    \"home_values\",\n",
    "    \"days_on_market\",\n",
    "]\n",
    "for config in configs:\n",
    "    print(config)\n",
    "    dataset = load_dataset(\"misikoff/zillow\", config, trust_remote_code=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Region ID': '102001',\n",
       " 'Size Rank': 0,\n",
       " 'Region': 'United States',\n",
       " 'Region Type': 'country',\n",
       " 'State': None,\n",
       " 'Home Type': 'SFR',\n",
       " 'Date': '2015-01-31',\n",
       " 'Rent (Smoothed)': 1251.1195068359375,\n",
       " 'Rent (Smoothed) (Seasonally Adjusted)': 1253.3807373046875}"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "next(iter((dataset[\"train\"])))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "gen = iter((dataset[\"train\"]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Region ID': '102001',\n",
       " 'Size Rank': 0,\n",
       " 'Region': 'United States',\n",
       " 'Region Type': 'country',\n",
       " 'State': None,\n",
       " 'Home Type': 'condo/co-op only',\n",
       " 'Date': '2018-03-31',\n",
       " 'Sale Price': 386700.0,\n",
       " 'Sale Price per Sqft': 238.31776428222656,\n",
       " 'Count': 4267}"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "next(gen)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "sta663",
   "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.12.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}