py_research.data module
Utilities for data handling.
-
is_number_dtype(dtype)[source]
Check if dtype is number-like.
- Parameters:
dtype (str | dtype[Any] | None | type[Any] | _SupportsDType[dtype[Any]] | tuple[Any, int] | tuple[Any, SupportsIndex | Sequence[SupportsIndex]] | list[Any] | _DTypeDict | tuple[Any, Any] | ExtensionDtype) – dtype to check.
- Returns:
True if dtype is number-like.
- Return type:
bool
-
to_boolean(s)[source]
Parse boolean series from string series.
- Parameters:
s (Series) – string series.
- Returns:
Boolean series.
- Return type:
Series
-
to_integer(s)[source]
Parse integer series from string series with locale-awareness.
- Parameters:
s (Series) – string series.
- Returns:
Integer series.
- Return type:
Series
-
to_float(s)[source]
Parse float series from string series with locale-awareness.
- Parameters:
s (Series) – string series.
- Returns:
Float series.
- Return type:
Series
-
parse_dtype(s, dtype=None, src_locale=None)[source]
Parse series to dtype with locale-awareness.
- Parameters:
-
- Returns:
Converted series.
- Return type:
Series
-
gen_id(x, length=10, raw_str=False)[source]
Generate stable hash for obj (must be known, hashable or composed of such).
- Parameters:
x (Any) – Object to hash.
length (int) – Length of the hash.
raw_str (bool) – Whether to use the raw string representation of the object,
if it is a string.
- Returns:
Hash of the object as string.
- Return type:
str