2.2.3.22. pycsamt.api.view.frame#
Pandas-friendly dataframe result objects for public pyCSAMT APIs.
Functions
|
Decorate a function so dataframe-like returns become |
|
Conditionally wrap data as an |
|
Wrap dataframe-like data using the configured API view backend. |
Classes
|
A pyCSAMT dataframe view that keeps pandas behavior intact. |
|
Small immutable profile describing a dataframe. |
- class pycsamt.api.view.frame.APIFrame(data=None, *, name=None, kind=None, source=None, units=None, meta=None, description=None, copy=False, **frame_kwargs)[source]
Bases:
PyCSAMTObjectA pyCSAMT dataframe view that keeps pandas behavior intact.
APIFrameis a thin wrapper aroundpandas.DataFrame. The dataframe remains available asdf; pyCSAMT adds compact display, metadata, units, statistics, and convenient conversion helpers.- Parameters:
- classmethod from_records(records, *, columns=None, **kwargs)[source]
Build an
APIFramefrom record dictionaries.
- property stats: FrameProfile[source]
Return a compact dataframe profile.
- summary(*, max_columns=8)[source]
Return a static display summary for printing.
- profile()[source]
Return the same object as
stats.- Return type:
- numeric_stats(**kwargs)[source]
Return pandas
describefor numeric columns.
- to_pandas(*, copy=False)[source]
Return the underlying dataframe, optionally copied.
- to_numpy(*args, **kwargs)[source]
Return dataframe values as a NumPy array.
- to_dict(*args, **kwargs)[source]
Delegate to
DataFrame.to_dictby default.
- copy(*, deep=True)[source]
Return a copied view preserving metadata.
- with_df(df, **overrides)[source]
Return a new
APIFramewith another dataframe.
- update_meta(**kwargs)[source]
Update metadata in-place and return
self.
- class pycsamt.api.view.frame.FrameProfile(rows, columns, column_names, numeric_columns, missing_cells, missing_fraction, memory_bytes)[source]
Bases:
objectSmall immutable profile describing a dataframe.
- Parameters:
- rows: int
- columns: int
- missing_cells: int
- missing_fraction: float
- memory_bytes: int
- pycsamt.api.view.frame.api_frame(_func=None, *, name=None, kind=None, source=None, units=None, meta=None, description=None, copy=False)[source]
Decorate a function so dataframe-like returns become
APIFrame.
- pycsamt.api.view.frame.maybe_wrap_frame(data, *, api=None, name=None, kind=None, source=None, units=None, meta=None, description=None, copy=False, **frame_kwargs)[source]
Conditionally wrap data as an
APIFrame.When api is
None(the default), the globalPYCSAMT_API_VIEWconfiguration decides. Passapi=Trueto force wrapping, orapi=Falseto always return the raw dataframe regardless of the global setting.
- pycsamt.api.view.frame.wrap_frame(data, *, name=None, kind=None, source=None, units=None, meta=None, description=None, copy=False, **frame_kwargs)[source]
Wrap dataframe-like data using the configured API view backend.