Skip to content
Permalink
Browse files

Add index=housing.index when wrapping array in a DataFrame, fixes #426

  • Loading branch information...
ageron committed May 12, 2019
1 parent 2d5d735 commit 6ef270d7b70148413573fa5109b57e5a202e4e5c
Showing with 5 additions and 3 deletions.
  1. +5 −3 02_end_to_end_machine_learning_project.ipynb
"outputs": [],
"source": [
"housing_tr = pd.DataFrame(X, columns=housing_num.columns,\n",
" index = list(housing.index.values))"
" index=housing.index)"
]
},
{
}
],
"source": [
"housing_tr = pd.DataFrame(X, columns=housing_num.columns)\n",
"housing_tr = pd.DataFrame(X, columns=housing_num.columns,\n",
" index=housing_num.index)\n",
"housing_tr.head()"
]
},
"source": [
"housing_extra_attribs = pd.DataFrame(\n",
" housing_extra_attribs,\n",
" columns=list(housing.columns)+[\"rooms_per_household\", \"population_per_household\"])\n",
" columns=list(housing.columns)+[\"rooms_per_household\", \"population_per_household\"],\n",
" index=housing.index)\n",
"housing_extra_attribs.head()"
]
},

0 comments on commit 6ef270d

Please sign in to comment.
You can’t perform that action at this time.