We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Nullable types not fully supported
Using pandas >= 1, columns of nullable integer type with low numbers of distinct values appear as "UNSUPPORTED".

This comes down to the check in `is_numeric` on whether there are infinite values in the series.

https://github.com/pandas-profiling/pandas-profiling/blob/216704bc6643ac691f3d1c513c0328c8cb29d088/src/pandas_profiling/model/base.py#L126

The following code gives a TypeError, which triggers the "except" branch in `get_var_type`

```
import pandas as pd
import numpy as np

series = pd.Series([1, None], dtype="Int64")
has_inf = any(np.inf == s or -np.inf == s for s in series)
```

I think that the following would be better:

```
has_inf = series.isin({np.inf, -np.inf}).any()
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/pandas_profiling/model/base.py`
Content:
```
1 """Common parts to all other modules, mainly utility functions."""
2 import imghdr
3 import os
4 from enum import Enum, unique
5 from urllib.parse import ParseResult, urlparse
6 
7 import numpy as np
8 import pandas as pd
9 from pandas.api.types import is_categorical_dtype
10 
11 from pandas_profiling.config import config
12 
13 
14 @unique
15 class Variable(Enum):
16     """The possible types of variables in the Profiling Report."""
17 
18     TYPE_CAT = "CAT"
19     """A categorical variable"""
20 
21     TYPE_BOOL = "BOOL"
22     """A boolean variable"""
23 
24     TYPE_NUM = "NUM"
25     """A numeric variable"""
26 
27     TYPE_DATE = "DATE"
28     """A date variable"""
29 
30     TYPE_URL = "URL"
31     """A URL variable"""
32 
33     TYPE_COMPLEX = "COMPLEX"
34 
35     TYPE_PATH = "PATH"
36     """Absolute path"""
37 
38     TYPE_FILE = "FILE"
39     """File (i.e. existing path)"""
40 
41     TYPE_IMAGE = "IMAGE"
42     """Images"""
43 
44     S_TYPE_UNSUPPORTED = "UNSUPPORTED"
45     """An unsupported variable"""
46 
47 
48 # Temporary mapping
49 Boolean = Variable.TYPE_BOOL
50 Real = Variable.TYPE_NUM
51 Count = Variable.TYPE_NUM
52 Complex = Variable.TYPE_COMPLEX
53 Date = Variable.TYPE_DATE
54 Categorical = Variable.TYPE_CAT
55 Url = Variable.TYPE_URL
56 AbsolutePath = Variable.TYPE_PATH
57 FilePath = Variable.TYPE_FILE
58 ImagePath = Variable.TYPE_IMAGE
59 Generic = Variable.S_TYPE_UNSUPPORTED
60 
61 
62 def get_counts(series: pd.Series) -> dict:
63     """Counts the values in a series (with and without NaN, distinct).
64 
65     Args:
66         series: Series for which we want to calculate the values.
67 
68     Returns:
69         A dictionary with the count values (with and without NaN, distinct).
70     """
71     if is_categorical_dtype(series):
72         series = series.cat.remove_unused_categories()
73 
74     value_counts_with_nan = series.value_counts(dropna=False)
75     value_counts_without_nan = (
76         value_counts_with_nan.reset_index().dropna().set_index("index").iloc[:, 0]
77     )
78     distinct_count_with_nan = value_counts_with_nan.count()
79     distinct_count_without_nan = value_counts_without_nan.count()
80 
81     return {
82         "value_counts": value_counts_without_nan,  # Alias
83         "value_counts_with_nan": value_counts_with_nan,
84         "value_counts_without_nan": value_counts_without_nan,
85         "distinct_count_with_nan": distinct_count_with_nan,
86         "distinct_count_without_nan": distinct_count_without_nan,
87     }
88 
89 
90 def is_boolean(series: pd.Series, series_description: dict) -> bool:
91     """Is the series boolean type?
92 
93     Args:
94         series: Series
95         series_description: Series description
96 
97     Returns:
98         True is the series is boolean type in the broad sense (e.g. including yes/no, NaNs allowed).
99     """
100     keys = series_description["value_counts_without_nan"].keys()
101     if pd.api.types.is_bool_dtype(keys):
102         return True
103     elif (
104         1 <= series_description["distinct_count_without_nan"] <= 2
105         and pd.api.types.is_numeric_dtype(series)
106         and series[~series.isnull()].between(0, 1).all()
107     ):
108         return True
109     elif 1 <= series_description["distinct_count_without_nan"] <= 4:
110         unique_values = set([str(value).lower() for value in keys.values])
111         accepted_combinations = [
112             ["y", "n"],
113             ["yes", "no"],
114             ["true", "false"],
115             ["t", "f"],
116         ]
117 
118         if len(unique_values) == 2 and any(
119             [unique_values == set(bools) for bools in accepted_combinations]
120         ):
121             return True
122 
123     return False
124 
125 
126 def is_numeric(series: pd.Series, series_description: dict) -> bool:
127     """Is the series numeric type?
128 
129     Args:
130         series: Series
131         series_description: Series description
132 
133     Returns:
134         True is the series is numeric type (NaNs allowed).
135     """
136     return pd.api.types.is_numeric_dtype(series) and (
137         series_description["distinct_count_without_nan"]
138         >= config["vars"]["num"]["low_categorical_threshold"].get(int)
139         or any(np.inf == s or -np.inf == s for s in series)
140     )
141 
142 
143 def is_url(series: pd.Series, series_description: dict) -> bool:
144     """Is the series url type?
145 
146     Args:
147         series: Series
148         series_description: Series description
149 
150     Returns:
151         True is the series is url type (NaNs allowed).
152     """
153 
154     def is_url_item(x):
155         return isinstance(x, ParseResult) and all((x.netloc, x.scheme, x.path))
156 
157     if series_description["distinct_count_without_nan"] > 0:
158         try:
159             result = series[~series.isnull()].astype(str)
160             return all(is_url_item(urlparse(x)) for x in result)
161         except ValueError:
162             return False
163     else:
164         return False
165 
166 
167 def is_path(series, series_description) -> bool:
168     """Is the series of the path type (i.e. absolute path)?
169 
170     Args:
171         series: Series
172         series_description: Series description
173 
174     Returns:
175         True is the series is path type (NaNs allowed).
176     """
177     if series_description["distinct_count_without_nan"] == 0:
178         return False
179 
180     try:
181         result = series[~series.isnull()].astype(str)
182         return all(os.path.isabs(p) for p in result)
183     except (ValueError, TypeError):
184         return False
185 
186 
187 def is_file(series, series_description) -> bool:
188     """Is the series of the type "file" (i.e. existing paths)?
189 
190     Args:
191         series: Series
192         series_description: Series description
193 
194     Returns:
195         True is the series is of the file type (NaNs allowed).
196     """
197     if series_description["distinct_count_without_nan"] == 0:
198         return False
199 
200     try:
201         result = series[~series.isnull()].astype(str)
202         return all(os.path.exists(p) for p in result)
203     except (ValueError, TypeError):
204         return False
205 
206 
207 def is_image(series, series_description) -> bool:
208     """Is the series of the image type (i.e. "file" with image extensions)?
209 
210     Args:
211         series: Series
212         series_description: Series description
213 
214     Returns:
215         True is the series is of the image type (NaNs allowed).
216     """
217     if series_description["distinct_count_without_nan"] > 0:
218         try:
219             result = series[~series.isnull()].astype(str)
220             return all(imghdr.what(p) for p in result)
221         except (TypeError, ValueError):
222             return False
223     else:
224         return False
225 
226 
227 def is_date(series) -> bool:
228     """Is the variable of type datetime? Throws a warning if the series looks like a datetime, but is not typed as
229     datetime64.
230 
231     Args:
232         series: Series
233 
234     Returns:
235         True if the variable is of type datetime.
236     """
237     is_date_value = pd.api.types.is_datetime64_dtype(series)
238 
239     return is_date_value
240 
241 
242 def get_var_type(series: pd.Series) -> dict:
243     """Get the variable type of a series.
244 
245     Args:
246         series: Series for which we want to infer the variable type.
247 
248     Returns:
249         The series updated with the variable type included.
250     """
251 
252     series_description = {}
253 
254     try:
255         series_description = get_counts(series)
256 
257         # When the inferred type of the index is just "mixed" probably the types within the series are tuple, dict,
258         # list and so on...
259         if series_description[
260             "value_counts_without_nan"
261         ].index.inferred_type.startswith("mixed"):
262             raise TypeError("Not supported mixed type")
263 
264         if series_description["distinct_count_without_nan"] == 0:
265             # Empty
266             var_type = Variable.S_TYPE_UNSUPPORTED
267         elif is_boolean(series, series_description):
268             var_type = Variable.TYPE_BOOL
269         elif is_numeric(series, series_description):
270             var_type = Variable.TYPE_NUM
271         elif is_date(series):
272             var_type = Variable.TYPE_DATE
273         elif is_url(series, series_description):
274             var_type = Variable.TYPE_URL
275         elif is_path(series, series_description):
276             if config["vars"]["file"]["active"].get(bool) and is_file(
277                 series, series_description
278             ):
279                 if config["vars"]["image"]["active"].get(bool) and is_image(
280                     series, series_description
281                 ):
282                     var_type = Variable.TYPE_IMAGE
283                 else:
284                     var_type = Variable.TYPE_FILE
285             else:
286                 var_type = Variable.TYPE_PATH
287         else:
288             var_type = Variable.TYPE_CAT
289     except TypeError:
290         var_type = Variable.S_TYPE_UNSUPPORTED
291 
292     series_description.update({"type": var_type})
293 
294     return series_description
295
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/pandas_profiling/model/base.py b/src/pandas_profiling/model/base.py
--- a/src/pandas_profiling/model/base.py
+++ b/src/pandas_profiling/model/base.py
@@ -136,7 +136,7 @@
     return pd.api.types.is_numeric_dtype(series) and (
         series_description["distinct_count_without_nan"]
         >= config["vars"]["num"]["low_categorical_threshold"].get(int)
-        or any(np.inf == s or -np.inf == s for s in series)
+        or series.isin({np.inf, -np.inf}).any()
     )

{"golden_diff": "diff --git a/src/pandas_profiling/model/base.py b/src/pandas_profiling/model/base.py\n--- a/src/pandas_profiling/model/base.py\n+++ b/src/pandas_profiling/model/base.py\n@@ -136,7 +136,7 @@\n     return pd.api.types.is_numeric_dtype(series) and (\n         series_description[\"distinct_count_without_nan\"]\n         >= config[\"vars\"][\"num\"][\"low_categorical_threshold\"].get(int)\n-        or any(np.inf == s or -np.inf == s for s in series)\n+        or series.isin({np.inf, -np.inf}).any()\n     )\n", "issue": "Nullable types not fully supported\nUsing pandas >= 1, columns of nullable integer type with low numbers of distinct values appear as \"UNSUPPORTED\".\r\n\r\nThis comes down to the check in `is_numeric` on whether there are infinite values in the series.\r\n\r\nhttps://github.com/pandas-profiling/pandas-profiling/blob/216704bc6643ac691f3d1c513c0328c8cb29d088/src/pandas_profiling/model/base.py#L126\r\n\r\nThe following code gives a TypeError, which triggers the \"except\" branch in `get_var_type`\r\n\r\n```\r\nimport pandas as pd\r\nimport numpy as np\r\n\r\nseries = pd.Series([1, None], dtype=\"Int64\")\r\nhas_inf = any(np.inf == s or -np.inf == s for s in series)\r\n```\r\n\r\nI think that the following would be better:\r\n\r\n```\r\nhas_inf = series.isin({np.inf, -np.inf}).any()\r\n```\r\n\n", "before_files": [{"content": "\"\"\"Common parts to all other modules, mainly utility functions.\"\"\"\nimport imghdr\nimport os\nfrom enum import Enum, unique\nfrom urllib.parse import ParseResult, urlparse\n\nimport numpy as np\nimport pandas as pd\nfrom pandas.api.types import is_categorical_dtype\n\nfrom pandas_profiling.config import config\n\n\n@unique\nclass Variable(Enum):\n    \"\"\"The possible types of variables in the Profiling Report.\"\"\"\n\n    TYPE_CAT = \"CAT\"\n    \"\"\"A categorical variable\"\"\"\n\n    TYPE_BOOL = \"BOOL\"\n    \"\"\"A boolean variable\"\"\"\n\n    TYPE_NUM = \"NUM\"\n    \"\"\"A numeric variable\"\"\"\n\n    TYPE_DATE = \"DATE\"\n    \"\"\"A date variable\"\"\"\n\n    TYPE_URL = \"URL\"\n    \"\"\"A URL variable\"\"\"\n\n    TYPE_COMPLEX = \"COMPLEX\"\n\n    TYPE_PATH = \"PATH\"\n    \"\"\"Absolute path\"\"\"\n\n    TYPE_FILE = \"FILE\"\n    \"\"\"File (i.e. existing path)\"\"\"\n\n    TYPE_IMAGE = \"IMAGE\"\n    \"\"\"Images\"\"\"\n\n    S_TYPE_UNSUPPORTED = \"UNSUPPORTED\"\n    \"\"\"An unsupported variable\"\"\"\n\n\n# Temporary mapping\nBoolean = Variable.TYPE_BOOL\nReal = Variable.TYPE_NUM\nCount = Variable.TYPE_NUM\nComplex = Variable.TYPE_COMPLEX\nDate = Variable.TYPE_DATE\nCategorical = Variable.TYPE_CAT\nUrl = Variable.TYPE_URL\nAbsolutePath = Variable.TYPE_PATH\nFilePath = Variable.TYPE_FILE\nImagePath = Variable.TYPE_IMAGE\nGeneric = Variable.S_TYPE_UNSUPPORTED\n\n\ndef get_counts(series: pd.Series) -> dict:\n    \"\"\"Counts the values in a series (with and without NaN, distinct).\n\n    Args:\n        series: Series for which we want to calculate the values.\n\n    Returns:\n        A dictionary with the count values (with and without NaN, distinct).\n    \"\"\"\n    if is_categorical_dtype(series):\n        series = series.cat.remove_unused_categories()\n\n    value_counts_with_nan = series.value_counts(dropna=False)\n    value_counts_without_nan = (\n        value_counts_with_nan.reset_index().dropna().set_index(\"index\").iloc[:, 0]\n    )\n    distinct_count_with_nan = value_counts_with_nan.count()\n    distinct_count_without_nan = value_counts_without_nan.count()\n\n    return {\n        \"value_counts\": value_counts_without_nan,  # Alias\n        \"value_counts_with_nan\": value_counts_with_nan,\n        \"value_counts_without_nan\": value_counts_without_nan,\n        \"distinct_count_with_nan\": distinct_count_with_nan,\n        \"distinct_count_without_nan\": distinct_count_without_nan,\n    }\n\n\ndef is_boolean(series: pd.Series, series_description: dict) -> bool:\n    \"\"\"Is the series boolean type?\n\n    Args:\n        series: Series\n        series_description: Series description\n\n    Returns:\n        True is the series is boolean type in the broad sense (e.g. including yes/no, NaNs allowed).\n    \"\"\"\n    keys = series_description[\"value_counts_without_nan\"].keys()\n    if pd.api.types.is_bool_dtype(keys):\n        return True\n    elif (\n        1 <= series_description[\"distinct_count_without_nan\"] <= 2\n        and pd.api.types.is_numeric_dtype(series)\n        and series[~series.isnull()].between(0, 1).all()\n    ):\n        return True\n    elif 1 <= series_description[\"distinct_count_without_nan\"] <= 4:\n        unique_values = set([str(value).lower() for value in keys.values])\n        accepted_combinations = [\n            [\"y\", \"n\"],\n            [\"yes\", \"no\"],\n            [\"true\", \"false\"],\n            [\"t\", \"f\"],\n        ]\n\n        if len(unique_values) == 2 and any(\n            [unique_values == set(bools) for bools in accepted_combinations]\n        ):\n            return True\n\n    return False\n\n\ndef is_numeric(series: pd.Series, series_description: dict) -> bool:\n    \"\"\"Is the series numeric type?\n\n    Args:\n        series: Series\n        series_description: Series description\n\n    Returns:\n        True is the series is numeric type (NaNs allowed).\n    \"\"\"\n    return pd.api.types.is_numeric_dtype(series) and (\n        series_description[\"distinct_count_without_nan\"]\n        >= config[\"vars\"][\"num\"][\"low_categorical_threshold\"].get(int)\n        or any(np.inf == s or -np.inf == s for s in series)\n    )\n\n\ndef is_url(series: pd.Series, series_description: dict) -> bool:\n    \"\"\"Is the series url type?\n\n    Args:\n        series: Series\n        series_description: Series description\n\n    Returns:\n        True is the series is url type (NaNs allowed).\n    \"\"\"\n\n    def is_url_item(x):\n        return isinstance(x, ParseResult) and all((x.netloc, x.scheme, x.path))\n\n    if series_description[\"distinct_count_without_nan\"] > 0:\n        try:\n            result = series[~series.isnull()].astype(str)\n            return all(is_url_item(urlparse(x)) for x in result)\n        except ValueError:\n            return False\n    else:\n        return False\n\n\ndef is_path(series, series_description) -> bool:\n    \"\"\"Is the series of the path type (i.e. absolute path)?\n\n    Args:\n        series: Series\n        series_description: Series description\n\n    Returns:\n        True is the series is path type (NaNs allowed).\n    \"\"\"\n    if series_description[\"distinct_count_without_nan\"] == 0:\n        return False\n\n    try:\n        result = series[~series.isnull()].astype(str)\n        return all(os.path.isabs(p) for p in result)\n    except (ValueError, TypeError):\n        return False\n\n\ndef is_file(series, series_description) -> bool:\n    \"\"\"Is the series of the type \"file\" (i.e. existing paths)?\n\n    Args:\n        series: Series\n        series_description: Series description\n\n    Returns:\n        True is the series is of the file type (NaNs allowed).\n    \"\"\"\n    if series_description[\"distinct_count_without_nan\"] == 0:\n        return False\n\n    try:\n        result = series[~series.isnull()].astype(str)\n        return all(os.path.exists(p) for p in result)\n    except (ValueError, TypeError):\n        return False\n\n\ndef is_image(series, series_description) -> bool:\n    \"\"\"Is the series of the image type (i.e. \"file\" with image extensions)?\n\n    Args:\n        series: Series\n        series_description: Series description\n\n    Returns:\n        True is the series is of the image type (NaNs allowed).\n    \"\"\"\n    if series_description[\"distinct_count_without_nan\"] > 0:\n        try:\n            result = series[~series.isnull()].astype(str)\n            return all(imghdr.what(p) for p in result)\n        except (TypeError, ValueError):\n            return False\n    else:\n        return False\n\n\ndef is_date(series) -> bool:\n    \"\"\"Is the variable of type datetime? Throws a warning if the series looks like a datetime, but is not typed as\n    datetime64.\n\n    Args:\n        series: Series\n\n    Returns:\n        True if the variable is of type datetime.\n    \"\"\"\n    is_date_value = pd.api.types.is_datetime64_dtype(series)\n\n    return is_date_value\n\n\ndef get_var_type(series: pd.Series) -> dict:\n    \"\"\"Get the variable type of a series.\n\n    Args:\n        series: Series for which we want to infer the variable type.\n\n    Returns:\n        The series updated with the variable type included.\n    \"\"\"\n\n    series_description = {}\n\n    try:\n        series_description = get_counts(series)\n\n        # When the inferred type of the index is just \"mixed\" probably the types within the series are tuple, dict,\n        # list and so on...\n        if series_description[\n            \"value_counts_without_nan\"\n        ].index.inferred_type.startswith(\"mixed\"):\n            raise TypeError(\"Not supported mixed type\")\n\n        if series_description[\"distinct_count_without_nan\"] == 0:\n            # Empty\n            var_type = Variable.S_TYPE_UNSUPPORTED\n        elif is_boolean(series, series_description):\n            var_type = Variable.TYPE_BOOL\n        elif is_numeric(series, series_description):\n            var_type = Variable.TYPE_NUM\n        elif is_date(series):\n            var_type = Variable.TYPE_DATE\n        elif is_url(series, series_description):\n            var_type = Variable.TYPE_URL\n        elif is_path(series, series_description):\n            if config[\"vars\"][\"file\"][\"active\"].get(bool) and is_file(\n                series, series_description\n            ):\n                if config[\"vars\"][\"image\"][\"active\"].get(bool) and is_image(\n                    series, series_description\n                ):\n                    var_type = Variable.TYPE_IMAGE\n                else:\n                    var_type = Variable.TYPE_FILE\n            else:\n                var_type = Variable.TYPE_PATH\n        else:\n            var_type = Variable.TYPE_CAT\n    except TypeError:\n        var_type = Variable.S_TYPE_UNSUPPORTED\n\n    series_description.update({\"type\": var_type})\n\n    return series_description\n", "path": "src/pandas_profiling/model/base.py"}], "after_files": [{"content": "\"\"\"Common parts to all other modules, mainly utility functions.\"\"\"\nimport imghdr\nimport os\nfrom enum import Enum, unique\nfrom urllib.parse import ParseResult, urlparse\n\nimport numpy as np\nimport pandas as pd\nfrom pandas.api.types import is_categorical_dtype\n\nfrom pandas_profiling.config import config\n\n\n@unique\nclass Variable(Enum):\n    \"\"\"The possible types of variables in the Profiling Report.\"\"\"\n\n    TYPE_CAT = \"CAT\"\n    \"\"\"A categorical variable\"\"\"\n\n    TYPE_BOOL = \"BOOL\"\n    \"\"\"A boolean variable\"\"\"\n\n    TYPE_NUM = \"NUM\"\n    \"\"\"A numeric variable\"\"\"\n\n    TYPE_DATE = \"DATE\"\n    \"\"\"A date variable\"\"\"\n\n    TYPE_URL = \"URL\"\n    \"\"\"A URL variable\"\"\"\n\n    TYPE_COMPLEX = \"COMPLEX\"\n\n    TYPE_PATH = \"PATH\"\n    \"\"\"Absolute path\"\"\"\n\n    TYPE_FILE = \"FILE\"\n    \"\"\"File (i.e. existing path)\"\"\"\n\n    TYPE_IMAGE = \"IMAGE\"\n    \"\"\"Images\"\"\"\n\n    S_TYPE_UNSUPPORTED = \"UNSUPPORTED\"\n    \"\"\"An unsupported variable\"\"\"\n\n\n# Temporary mapping\nBoolean = Variable.TYPE_BOOL\nReal = Variable.TYPE_NUM\nCount = Variable.TYPE_NUM\nComplex = Variable.TYPE_COMPLEX\nDate = Variable.TYPE_DATE\nCategorical = Variable.TYPE_CAT\nUrl = Variable.TYPE_URL\nAbsolutePath = Variable.TYPE_PATH\nFilePath = Variable.TYPE_FILE\nImagePath = Variable.TYPE_IMAGE\nGeneric = Variable.S_TYPE_UNSUPPORTED\n\n\ndef get_counts(series: pd.Series) -> dict:\n    \"\"\"Counts the values in a series (with and without NaN, distinct).\n\n    Args:\n        series: Series for which we want to calculate the values.\n\n    Returns:\n        A dictionary with the count values (with and without NaN, distinct).\n    \"\"\"\n    if is_categorical_dtype(series):\n        series = series.cat.remove_unused_categories()\n\n    value_counts_with_nan = series.value_counts(dropna=False)\n    value_counts_without_nan = (\n        value_counts_with_nan.reset_index().dropna().set_index(\"index\").iloc[:, 0]\n    )\n    distinct_count_with_nan = value_counts_with_nan.count()\n    distinct_count_without_nan = value_counts_without_nan.count()\n\n    return {\n        \"value_counts\": value_counts_without_nan,  # Alias\n        \"value_counts_with_nan\": value_counts_with_nan,\n        \"value_counts_without_nan\": value_counts_without_nan,\n        \"distinct_count_with_nan\": distinct_count_with_nan,\n        \"distinct_count_without_nan\": distinct_count_without_nan,\n    }\n\n\ndef is_boolean(series: pd.Series, series_description: dict) -> bool:\n    \"\"\"Is the series boolean type?\n\n    Args:\n        series: Series\n        series_description: Series description\n\n    Returns:\n        True is the series is boolean type in the broad sense (e.g. including yes/no, NaNs allowed).\n    \"\"\"\n    keys = series_description[\"value_counts_without_nan\"].keys()\n    if pd.api.types.is_bool_dtype(keys):\n        return True\n    elif (\n        1 <= series_description[\"distinct_count_without_nan\"] <= 2\n        and pd.api.types.is_numeric_dtype(series)\n        and series[~series.isnull()].between(0, 1).all()\n    ):\n        return True\n    elif 1 <= series_description[\"distinct_count_without_nan\"] <= 4:\n        unique_values = set([str(value).lower() for value in keys.values])\n        accepted_combinations = [\n            [\"y\", \"n\"],\n            [\"yes\", \"no\"],\n            [\"true\", \"false\"],\n            [\"t\", \"f\"],\n        ]\n\n        if len(unique_values) == 2 and any(\n            [unique_values == set(bools) for bools in accepted_combinations]\n        ):\n            return True\n\n    return False\n\n\ndef is_numeric(series: pd.Series, series_description: dict) -> bool:\n    \"\"\"Is the series numeric type?\n\n    Args:\n        series: Series\n        series_description: Series description\n\n    Returns:\n        True is the series is numeric type (NaNs allowed).\n    \"\"\"\n    return pd.api.types.is_numeric_dtype(series) and (\n        series_description[\"distinct_count_without_nan\"]\n        >= config[\"vars\"][\"num\"][\"low_categorical_threshold\"].get(int)\n        or series.isin({np.inf, -np.inf}).any()\n    )\n\n\ndef is_url(series: pd.Series, series_description: dict) -> bool:\n    \"\"\"Is the series url type?\n\n    Args:\n        series: Series\n        series_description: Series description\n\n    Returns:\n        True is the series is url type (NaNs allowed).\n    \"\"\"\n\n    def is_url_item(x):\n        return isinstance(x, ParseResult) and all((x.netloc, x.scheme, x.path))\n\n    if series_description[\"distinct_count_without_nan\"] > 0:\n        try:\n            result = series[~series.isnull()].astype(str)\n            return all(is_url_item(urlparse(x)) for x in result)\n        except ValueError:\n            return False\n    else:\n        return False\n\n\ndef is_path(series, series_description) -> bool:\n    \"\"\"Is the series of the path type (i.e. absolute path)?\n\n    Args:\n        series: Series\n        series_description: Series description\n\n    Returns:\n        True is the series is path type (NaNs allowed).\n    \"\"\"\n    if series_description[\"distinct_count_without_nan\"] == 0:\n        return False\n\n    try:\n        result = series[~series.isnull()].astype(str)\n        return all(os.path.isabs(p) for p in result)\n    except (ValueError, TypeError):\n        return False\n\n\ndef is_file(series, series_description) -> bool:\n    \"\"\"Is the series of the type \"file\" (i.e. existing paths)?\n\n    Args:\n        series: Series\n        series_description: Series description\n\n    Returns:\n        True is the series is of the file type (NaNs allowed).\n    \"\"\"\n    if series_description[\"distinct_count_without_nan\"] == 0:\n        return False\n\n    try:\n        result = series[~series.isnull()].astype(str)\n        return all(os.path.exists(p) for p in result)\n    except (ValueError, TypeError):\n        return False\n\n\ndef is_image(series, series_description) -> bool:\n    \"\"\"Is the series of the image type (i.e. \"file\" with image extensions)?\n\n    Args:\n        series: Series\n        series_description: Series description\n\n    Returns:\n        True is the series is of the image type (NaNs allowed).\n    \"\"\"\n    if series_description[\"distinct_count_without_nan\"] > 0:\n        try:\n            result = series[~series.isnull()].astype(str)\n            return all(imghdr.what(p) for p in result)\n        except (TypeError, ValueError):\n            return False\n    else:\n        return False\n\n\ndef is_date(series) -> bool:\n    \"\"\"Is the variable of type datetime? Throws a warning if the series looks like a datetime, but is not typed as\n    datetime64.\n\n    Args:\n        series: Series\n\n    Returns:\n        True if the variable is of type datetime.\n    \"\"\"\n    is_date_value = pd.api.types.is_datetime64_dtype(series)\n\n    return is_date_value\n\n\ndef get_var_type(series: pd.Series) -> dict:\n    \"\"\"Get the variable type of a series.\n\n    Args:\n        series: Series for which we want to infer the variable type.\n\n    Returns:\n        The series updated with the variable type included.\n    \"\"\"\n\n    series_description = {}\n\n    try:\n        series_description = get_counts(series)\n\n        # When the inferred type of the index is just \"mixed\" probably the types within the series are tuple, dict,\n        # list and so on...\n        if series_description[\n            \"value_counts_without_nan\"\n        ].index.inferred_type.startswith(\"mixed\"):\n            raise TypeError(\"Not supported mixed type\")\n\n        if series_description[\"distinct_count_without_nan\"] == 0:\n            # Empty\n            var_type = Variable.S_TYPE_UNSUPPORTED\n        elif is_boolean(series, series_description):\n            var_type = Variable.TYPE_BOOL\n        elif is_numeric(series, series_description):\n            var_type = Variable.TYPE_NUM\n        elif is_date(series):\n            var_type = Variable.TYPE_DATE\n        elif is_url(series, series_description):\n            var_type = Variable.TYPE_URL\n        elif is_path(series, series_description):\n            if config[\"vars\"][\"file\"][\"active\"].get(bool) and is_file(\n                series, series_description\n            ):\n                if config[\"vars\"][\"image\"][\"active\"].get(bool) and is_image(\n                    series, series_description\n                ):\n                    var_type = Variable.TYPE_IMAGE\n                else:\n                    var_type = Variable.TYPE_FILE\n            else:\n                var_type = Variable.TYPE_PATH\n        else:\n            var_type = Variable.TYPE_CAT\n    except TypeError:\n        var_type = Variable.S_TYPE_UNSUPPORTED\n\n    series_description.update({\"type\": var_type})\n\n    return series_description\n", "path": "src/pandas_profiling/model/base.py"}]}