ansys.dyna.core.lib.io_utils#
Utils for i/o.
Functions#
|
Write to buffer or returns a string. |
|
Check if object is a pandas DataFrame using duck typing. |
Module Contents#
- ansys.dyna.core.lib.io_utils.write_or_return(buf: TextIO | None, func: Callable) str | None[source]#
Write to buffer or returns a string.
Uses the callable func to write. If buf is None, then the function will create a string buffer before calling func and return the result as a string.
- ansys.dyna.core.lib.io_utils.is_dataframe(obj) bool[source]#
Check if object is a pandas DataFrame using duck typing.
Uses duck typing instead of isinstance() for Python 3.13+ compatibility, where pd.DataFrame is no longer a valid type for isinstance checks.
- Parameters:
- obj
Any Object to check.
- obj
- Returns:
- bool
True if obj has DataFrame-like attributes.