Add index=housing.index when wrapping array in a DataFrame, fixes #426
parent
f0f83903bd
commit
ec3136f59f
|
@ -753,7 +753,7 @@
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"housing_tr = pd.DataFrame(X, columns=housing_num.columns,\n",
|
"housing_tr = pd.DataFrame(X, columns=housing_num.columns,\n",
|
||||||
" index = list(housing.index.values))"
|
" index=housing.index)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -780,7 +780,8 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"housing_tr = pd.DataFrame(X, columns=housing_num.columns)"
|
"housing_tr = pd.DataFrame(X, columns=housing_num.columns,\n",
|
||||||
|
" index=housing_num.index)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -932,7 +933,8 @@
|
||||||
"source": [
|
"source": [
|
||||||
"housing_extra_attribs = pd.DataFrame(\n",
|
"housing_extra_attribs = pd.DataFrame(\n",
|
||||||
" housing_extra_attribs,\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()"
|
"housing_extra_attribs.head()"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue