# Checks for all kinds of nan/None values without raising Exceptions all the time
```python
from check_if_nan import is_nan,sort_nan_non_nan
import numpy as np
import pandas as pd
import math
a = None
b = pd.NA
c = np.nan
d = math.nan
e = float("nan")
f = []
g = np.array([])
h = dict()
i = tuple()
j = set()
k = ""
l = "NaN"
m = b""
n = bytearray()
print("a", is_nan(a))
print("b", is_nan(b))
print("c", is_nan(c))
print("d", is_nan(d))
print("e", is_nan(e))
print("f", is_nan(f))
print("g", is_nan(g))
print("h", is_nan(h))
print("i", is_nan(i))
print("j", is_nan(j))
print("k", is_nan(k))
print("l", is_nan(l))
print("m", is_nan(m))
print("n", is_nan(n))
print("f", is_nan(f, emptyiters=True))
print("g", is_nan(g, emptyiters=True))
print("h", is_nan(h, emptyiters=True))
print("i", is_nan(i, emptyiters=True))
print("j", is_nan(j, emptyiters=True))
print("k", is_nan(k, emptystrings=True))
print("l", is_nan(l, nastrings=True))
print("m", is_nan(m, emptybytes=True))
print("n", is_nan(n, emptyiters=True))
a True
b True
c True
d True
e True
f False
g False
h False
i False
j False
k False
l False
m False
n False
f True
g True
h True
i True
j True
k True
l True
m True
n True
sor = sort_nan_non_nan(
seq=[a, b, c, d, e, f, g, h, i, j, k, l, m, n],
emptyiters=False,
nastrings=False,
emptystrings=False,
emptybytes=False,
)
print(sor)
# defaultdict(<class 'list'>, {True: [(0, None), (1, <NA>), (2, nan),
# (3, nan), (4, nan)], False: [(5, []), (6, array([], dtype=float64)),
# (7, {}), (8, ()), (9, set()), (10, ''), (11, 'NaN'), (12, b''),
# (13, bytearray(b''))]})
sor = sort_nan_non_nan(
seq=[a, b, c, d, e, f, g, h, i, j, k, l, m, n],
emptyiters=True,
nastrings=False,
emptystrings=False,
emptybytes=False,
)
print(sor)
# defaultdict(<class 'list'>, {True: [(0, None), (1, <NA>), (2, nan),
# (3, nan), (4, nan), (5, []), (6, array([], dtype=float64)),
# (7, {}), (8, ()), (9, set()), (13, bytearray(b''))],
# False: [(10, ''), (11, 'NaN'), (12, b'')]})
sor = sort_nan_non_nan(
seq=[a, b, c, d, e, f, g, h, i, j, k, l, m, n],
emptyiters=True,
nastrings=False,
emptystrings=True,
emptybytes=True,
)
print(sor)
# defaultdict(<class 'list'>, {True: [(0, None), (1, <NA>), (2, nan), (3, nan),
# (4, nan), (5, []), (6, array([], dtype=float64)), (7, {}), (8, ()),
# (9, set()), (10, ''), (12, b''), (13, bytearray(b''))], False: [(11, 'NaN')]})
sor = sort_nan_non_nan(
seq=[a, b, c, d, e, f, g, h, i, j, k, l, m, n],
emptyiters=True,
nastrings=True,
emptystrings=True,
emptybytes=True,
)
print(sor)
# defaultdict(<class 'list'>, {True: [(0, None), (1, <NA>), (2, nan),
# (3, nan), (4, nan), (5, []), (6, array([], dtype=float64)), (7, {}),
# (8, ()), (9, set()), (10, ''), (11, 'NaN'), (12, b''), (13, bytearray(b''))]})
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/check_if_nan",
"name": "check-if-nan",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "nan,None",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/65/d3/a1324cb74dc9c8999800eddecaac9953e612a6185cf657867bbd4ce47bef/check_if_nan-0.11.tar.gz",
"platform": null,
"description": "# Checks for all kinds of nan/None values without raising Exceptions all the time\r\n\r\n\r\n```python\r\nfrom check_if_nan import is_nan,sort_nan_non_nan\r\nimport numpy as np\r\nimport pandas as pd\r\nimport math\r\na = None\r\nb = pd.NA\r\nc = np.nan\r\nd = math.nan\r\ne = float(\"nan\")\r\nf = []\r\ng = np.array([])\r\nh = dict()\r\ni = tuple()\r\nj = set()\r\nk = \"\"\r\nl = \"NaN\"\r\nm = b\"\"\r\nn = bytearray()\r\n\r\n\r\nprint(\"a\", is_nan(a))\r\nprint(\"b\", is_nan(b))\r\nprint(\"c\", is_nan(c))\r\nprint(\"d\", is_nan(d))\r\nprint(\"e\", is_nan(e))\r\nprint(\"f\", is_nan(f))\r\nprint(\"g\", is_nan(g))\r\nprint(\"h\", is_nan(h))\r\nprint(\"i\", is_nan(i))\r\nprint(\"j\", is_nan(j))\r\nprint(\"k\", is_nan(k))\r\nprint(\"l\", is_nan(l))\r\nprint(\"m\", is_nan(m))\r\nprint(\"n\", is_nan(n))\r\n\r\nprint(\"f\", is_nan(f, emptyiters=True))\r\nprint(\"g\", is_nan(g, emptyiters=True))\r\nprint(\"h\", is_nan(h, emptyiters=True))\r\nprint(\"i\", is_nan(i, emptyiters=True))\r\nprint(\"j\", is_nan(j, emptyiters=True))\r\nprint(\"k\", is_nan(k, emptystrings=True))\r\nprint(\"l\", is_nan(l, nastrings=True))\r\nprint(\"m\", is_nan(m, emptybytes=True))\r\nprint(\"n\", is_nan(n, emptyiters=True))\r\n\r\n\r\na True\r\nb True\r\nc True\r\nd True\r\ne True\r\nf False\r\ng False\r\nh False\r\ni False\r\nj False\r\nk False\r\nl False\r\nm False\r\nn False\r\n\r\n\r\nf True\r\ng True\r\nh True\r\ni True\r\nj True\r\nk True\r\nl True\r\nm True\r\nn True\r\n\r\n\r\nsor = sort_nan_non_nan(\r\n seq=[a, b, c, d, e, f, g, h, i, j, k, l, m, n],\r\n emptyiters=False,\r\n nastrings=False,\r\n emptystrings=False,\r\n emptybytes=False,\r\n)\r\nprint(sor)\r\n# defaultdict(<class 'list'>, {True: [(0, None), (1, <NA>), (2, nan),\r\n# (3, nan), (4, nan)], False: [(5, []), (6, array([], dtype=float64)),\r\n# (7, {}), (8, ()), (9, set()), (10, ''), (11, 'NaN'), (12, b''),\r\n# (13, bytearray(b''))]})\r\n\r\nsor = sort_nan_non_nan(\r\n seq=[a, b, c, d, e, f, g, h, i, j, k, l, m, n],\r\n emptyiters=True,\r\n nastrings=False,\r\n emptystrings=False,\r\n emptybytes=False,\r\n)\r\nprint(sor)\r\n# defaultdict(<class 'list'>, {True: [(0, None), (1, <NA>), (2, nan),\r\n# (3, nan), (4, nan), (5, []), (6, array([], dtype=float64)),\r\n# (7, {}), (8, ()), (9, set()), (13, bytearray(b''))],\r\n# False: [(10, ''), (11, 'NaN'), (12, b'')]})\r\n\r\n\r\nsor = sort_nan_non_nan(\r\n seq=[a, b, c, d, e, f, g, h, i, j, k, l, m, n],\r\n emptyiters=True,\r\n nastrings=False,\r\n emptystrings=True,\r\n emptybytes=True,\r\n)\r\nprint(sor)\r\n# defaultdict(<class 'list'>, {True: [(0, None), (1, <NA>), (2, nan), (3, nan),\r\n# (4, nan), (5, []), (6, array([], dtype=float64)), (7, {}), (8, ()),\r\n# (9, set()), (10, ''), (12, b''), (13, bytearray(b''))], False: [(11, 'NaN')]})\r\n\r\nsor = sort_nan_non_nan(\r\n seq=[a, b, c, d, e, f, g, h, i, j, k, l, m, n],\r\n emptyiters=True,\r\n nastrings=True,\r\n emptystrings=True,\r\n emptybytes=True,\r\n)\r\nprint(sor)\r\n# defaultdict(<class 'list'>, {True: [(0, None), (1, <NA>), (2, nan),\r\n# (3, nan), (4, nan), (5, []), (6, array([], dtype=float64)), (7, {}),\r\n# (8, ()), (9, set()), (10, ''), (11, 'NaN'), (12, b''), (13, bytearray(b''))]})\r\n```\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Checks for all kinds of nan/None values without raising Exceptions all the time",
"version": "0.11",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/check_if_nan"
},
"split_keywords": [
"nan",
"none"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4b7131681f3c0d25e578018216984c2405a0301e36aa76350179e15e35613ad2",
"md5": "8b2a1a2970cf7f85e5494631b3b72318",
"sha256": "92b33427fb19c1535a2fb455e54073bf488c928b21a490e28ab65f3ade5aa3c0"
},
"downloads": -1,
"filename": "check_if_nan-0.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8b2a1a2970cf7f85e5494631b3b72318",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 22538,
"upload_time": "2023-05-03T00:51:45",
"upload_time_iso_8601": "2023-05-03T00:51:45.141959Z",
"url": "https://files.pythonhosted.org/packages/4b/71/31681f3c0d25e578018216984c2405a0301e36aa76350179e15e35613ad2/check_if_nan-0.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "65d3a1324cb74dc9c8999800eddecaac9953e612a6185cf657867bbd4ce47bef",
"md5": "9c95e865d6e673132ebeefae01ac24a8",
"sha256": "bf047164e3a24fd17c37d01576d10627d371da6780979dcfe27148a7f01e1d06"
},
"downloads": -1,
"filename": "check_if_nan-0.11.tar.gz",
"has_sig": false,
"md5_digest": "9c95e865d6e673132ebeefae01ac24a8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 22061,
"upload_time": "2023-05-03T00:51:47",
"upload_time_iso_8601": "2023-05-03T00:51:47.691986Z",
"url": "https://files.pythonhosted.org/packages/65/d3/a1324cb74dc9c8999800eddecaac9953e612a6185cf657867bbd4ce47bef/check_if_nan-0.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-03 00:51:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hansalemaos",
"github_project": "check_if_nan",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "disable_warnings",
"specs": []
},
{
"name": "numpy",
"specs": []
},
{
"name": "pandas",
"specs": []
}
],
"lcname": "check-if-nan"
}