{ "cells": [ { "metadata": { "trusted": true }, "cell_type": "code", "source": "from fastai import * # Quick access to most common functionality\nfrom fastai.tabular import * # Quick access to tabular functionality\nfrom fastai.docs import * # Access to example data provided with fastai", "execution_count": 1, "outputs": [] }, { "metadata": { "trusted": true }, "cell_type": "code", "source": "df = get_adult()\ntrain_df, valid_df = df[:-2000].copy(),df[-2000:].copy()\ntrain_df.head()", "execution_count": 2, "outputs": [ { "output_type": "execute_result", "execution_count": 2, "data": { "text/plain": " age workclass fnlwgt education education-num \\\n0 49 Private 101320 Assoc-acdm 12.0 \n1 44 Private 236746 Masters 14.0 \n2 38 Private 96185 HS-grad NaN \n3 38 Self-emp-inc 112847 Prof-school 15.0 \n4 42 Self-emp-not-inc 82297 7th-8th NaN \n\n marital-status occupation relationship race \\\n0 Married-civ-spouse NaN Wife White \n1 Divorced Exec-managerial Not-in-family White \n2 Divorced NaN Unmarried Black \n3 Married-civ-spouse Prof-specialty Husband Asian-Pac-Islander \n4 Married-civ-spouse Other-service Wife Black \n\n sex capital-gain capital-loss hours-per-week native-country >=50k \n0 Female 0 1902 40 United-States 1 \n1 Male 10520 0 45 United-States 1 \n2 Female 0 0 32 United-States 0 \n3 Male 0 0 40 United-States 1 \n4 Female 0 0 50 United-States 0 ", "text/html": "
| \n | age | \nworkclass | \nfnlwgt | \neducation | \neducation-num | \nmarital-status | \noccupation | \nrelationship | \nrace | \nsex | \ncapital-gain | \ncapital-loss | \nhours-per-week | \nnative-country | \n>=50k | \n
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n49 | \nPrivate | \n101320 | \nAssoc-acdm | \n12.0 | \nMarried-civ-spouse | \nNaN | \nWife | \nWhite | \nFemale | \n0 | \n1902 | \n40 | \nUnited-States | \n1 | \n
| 1 | \n44 | \nPrivate | \n236746 | \nMasters | \n14.0 | \nDivorced | \nExec-managerial | \nNot-in-family | \nWhite | \nMale | \n10520 | \n0 | \n45 | \nUnited-States | \n1 | \n
| 2 | \n38 | \nPrivate | \n96185 | \nHS-grad | \nNaN | \nDivorced | \nNaN | \nUnmarried | \nBlack | \nFemale | \n0 | \n0 | \n32 | \nUnited-States | \n0 | \n
| 3 | \n38 | \nSelf-emp-inc | \n112847 | \nProf-school | \n15.0 | \nMarried-civ-spouse | \nProf-specialty | \nHusband | \nAsian-Pac-Islander | \nMale | \n0 | \n0 | \n40 | \nUnited-States | \n1 | \n
| 4 | \n42 | \nSelf-emp-not-inc | \n82297 | \n7th-8th | \nNaN | \nMarried-civ-spouse | \nOther-service | \nWife | \nBlack | \nFemale | \n0 | \n0 | \n50 | \nUnited-States | \n0 | \n