Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Pandas parser does fail to parse integer or boolean only datafra…
…mes (#1683) - fixes #1678 Converting the Series returned by `iterrows()` to a dict converts `np.int64` type to python's native `int` type and fixes the bug (same with booleans). + Adding non-regression tests - I was also concerned with the next lines, especially : `if value is np.nan: value = None` - it was untested, so I added a test. It looks like `to_dict` would not change the behavior of `np.nan` conversion (see side note), so I left this code unchanged. - Primary keys are returned as `int`s or `tuple[int]`, no `np.int64` there - `Timestamps` types are kept unchanged, so the `if isinstance(value, pd.Timestamp):` still applies. ## Side note `np.nan` behavior is quite strange with `df.iterrows()` : in a number column, it will be converted to `float("nan")`, whereas in string column it will be kept as `np.nan`. Adding `to_dict()` to the row Series does not change the types.
- Loading branch information