Added examples of what this type is

It's not pd.nan.
This commit is contained in:
Shaun Verch 2022-01-12 17:36:06 -05:00
parent 9849b465b7
commit d48926d377

View file

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 2,
"id": "cd5233fd-8ace-43c8-98c0-7db75447d7d9", "id": "cd5233fd-8ace-43c8-98c0-7db75447d7d9",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -13,7 +13,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 3,
"id": "1e478534-dabf-4f6d-a9fd-9553c2c3ad5c", "id": "1e478534-dabf-4f6d-a9fd-9553c2c3ad5c",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -25,7 +25,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": 4,
"id": "88d362e7-d0e6-4ac8-9795-6db75f367099", "id": "88d362e7-d0e6-4ac8-9795-6db75f367099",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -92,7 +92,7 @@
"d NaN NaN NaN" "d NaN NaN NaN"
] ]
}, },
"execution_count": 20, "execution_count": 4,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -103,7 +103,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 5,
"id": "b63a77da-3ede-4997-a374-10cb74d93df5", "id": "b63a77da-3ede-4997-a374-10cb74d93df5",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -170,7 +170,7 @@
"d <NA> NaN NaN" "d <NA> NaN NaN"
] ]
}, },
"execution_count": 21, "execution_count": 5,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -182,33 +182,128 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22, "execution_count": 11,
"id": "99958e76-edcf-4e3e-aee8-2bfd3c1213d6", "id": "99958e76-edcf-4e3e-aee8-2bfd3c1213d6",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"a 1\n", "True"
"b 1\n",
"c 1\n",
"d <NA>\n",
"Name: X, dtype: Int64"
] ]
}, },
"execution_count": 22, "execution_count": 11,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
], ],
"source": [ "source": [
"df[\"X\"]" "df[\"X\"][\"d\"] is pd.NA"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "029f3277-af92-48b6-83bf-7dd16bbbec40",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df[\"X\"][\"c\"] is pd.NA"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "b111b0dc-efe5-4a0c-95b7-e29108c43432",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>X</th>\n",
" <th>Y</th>\n",
" <th>Z</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>a</th>\n",
" <td>1</td>\n",
" <td>2.0</td>\n",
" <td>3.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>b</th>\n",
" <td>1</td>\n",
" <td>2.0</td>\n",
" <td>3.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>c</th>\n",
" <td>1</td>\n",
" <td>2.0</td>\n",
" <td>3.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>d</th>\n",
" <td>0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" X Y Z\n",
"a 1 2.0 3.0\n",
"b 1 2.0 3.0\n",
"c 1 2.0 3.0\n",
"d 0 0.0 0.0"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.fillna(0)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "029f3277-af92-48b6-83bf-7dd16bbbec40", "id": "bb796b5f-37b4-4ea8-9d79-54157bfadce4",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []