GeezerVison is showing github.com — counting nan rows · Sahoopa/python_reference@367d8f9
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: tutorials/things_in_pandas.ipynb +39-1Lines changed: 39 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 29 | 29 | "output_type": "stream", | 30 | 30 | "stream": "stdout", | 31 | 31 | "text": [ | 32 | | - "Sebastian Raschka 25/01/2015 \n", | | 32 | + "Sebastian Raschka 28/01/2015 \n", | 33 | 33 | "\n", | 34 | 34 | "CPython 3.4.2\n", | 35 | 35 | "IPython 2.3.1\n", | | 90 | 90 | " - [Changing Values in a Column](#Changing-Values-in-a-Column)\n", | 91 | 91 | " - [Adding a New Column](#Adding-a-New-Column)\n", | 92 | 92 | "- [Missing Values aka NaNs](#Missing-Values-aka-NaNs)\n", | | 93 | + " - [Counting Rows with NaNs](#Counting-Rows-with-NaNs)\n", | 93 | 94 | " - [Selecting NaN Rows](#Selecting-NaN-Rows)\n", | 94 | 95 | " - [Selecting non-NaN Rows](#Selecting-non-NaN-Rows)\n", | 95 | 96 | " - [Filling NaN Rows](#Filling-NaN-Rows)\n", | | 937 | 938 | "<br>" | 938 | 939 | ] | 939 | 940 | }, | | 941 | + { | | 942 | + "cell_type": "heading", | | 943 | + "level": 3, | | 944 | + "metadata": {}, | | 945 | + "source": [ | | 946 | + "Counting Rows with NaNs" | | 947 | + ] | | 948 | + }, | | 949 | + { | | 950 | + "cell_type": "code", | | 951 | + "collapsed": false, | | 952 | + "input": [ | | 953 | + "nans = df.shape[0] - df.dropna().shape[0]\n", | | 954 | + "\n", | | 955 | + "print('%d rows have missing values' % nans)" | | 956 | + ], | | 957 | + "language": "python", | | 958 | + "metadata": {}, | | 959 | + "outputs": [ | | 960 | + { | | 961 | + "output_type": "stream", | | 962 | + "stream": "stdout", | | 963 | + "text": [ | | 964 | + "3 rows have missing values\n" | | 965 | + ] | | 966 | + } | | 967 | + ], | | 968 | + "prompt_number": 8 | | 969 | + }, | | 970 | + { | | 971 | + "cell_type": "markdown", | | 972 | + "metadata": {}, | | 973 | + "source": [ | | 974 | + "<br>\n", | | 975 | + "<br>" | | 976 | + ] | | 977 | + }, | 940 | 978 | { | 941 | 979 | "cell_type": "heading", | 942 | 980 | "level": 3, | |
|