mirror of
https://github.com/rasbt/python_reference.git
synced 2024-11-23 20:11:13 +00:00
counting nan rows
This commit is contained in:
parent
d2039a7868
commit
367d8f9935
|
@ -29,7 +29,7 @@
|
|||
"output_type": "stream",
|
||||
"stream": "stdout",
|
||||
"text": [
|
||||
"Sebastian Raschka 25/01/2015 \n",
|
||||
"Sebastian Raschka 28/01/2015 \n",
|
||||
"\n",
|
||||
"CPython 3.4.2\n",
|
||||
"IPython 2.3.1\n",
|
||||
|
@ -90,6 +90,7 @@
|
|||
" - [Changing Values in a Column](#Changing-Values-in-a-Column)\n",
|
||||
" - [Adding a New Column](#Adding-a-New-Column)\n",
|
||||
"- [Missing Values aka NaNs](#Missing-Values-aka-NaNs)\n",
|
||||
" - [Counting Rows with NaNs](#Counting-Rows-with-NaNs)\n",
|
||||
" - [Selecting NaN Rows](#Selecting-NaN-Rows)\n",
|
||||
" - [Selecting non-NaN Rows](#Selecting-non-NaN-Rows)\n",
|
||||
" - [Filling NaN Rows](#Filling-NaN-Rows)\n",
|
||||
|
@ -937,6 +938,43 @@
|
|||
"<br>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "heading",
|
||||
"level": 3,
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Counting Rows with NaNs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"nans = df.shape[0] - df.dropna().shape[0]\n",
|
||||
"\n",
|
||||
"print('%d rows have missing values' % nans)"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "stream",
|
||||
"stream": "stdout",
|
||||
"text": [
|
||||
"3 rows have missing values\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 8
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<br>\n",
|
||||
"<br>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "heading",
|
||||
"level": 3,
|
||||
|
|
Loading…
Reference in New Issue
Block a user