pandas module
The apsg.pandas module bridges APSG feature sets with pandas.
It provides array wrappers (FolArray, LinArray, Vec3Array, FaultArray) that store
APSG features as pandas extension arrays, enabling seamless integration with DataFrames.
Usage
Start by importing pd from the apsg.pandas submodule and feature aliases from apsg:
>>> from apsg import fol, lin
>>> from apsg.pandas import pd
Create a DataFrame with numerical columns for azimuth and inclination:
>>> df = pd.DataFrame({
... "azi": [145, 156, 173, 142, 153],
... "inc": [38, 42, 36, 54, 41],
... })
Convert numerical columns into an APSG feature column using the apsg accessor:
>>> df = df.apsg.create_fols(columns=["azi", "inc"])
Now use column-specific accessors for analysis and plotting:
>>> df.fol.G # FeatureSet from the fol column
>>> df.fol.fisher_k() # Fisher precision parameter
>>> df.fol.ortensor() # Orientation tensor
The same approach works for linear features using create_lins:
>>> df = df.apsg.create_lins(columns=["azi", "inc"], name="lins")
>>> df.lin.G
>>> df.lin.fisher_k()
Classes:
|
Custom Extension Array type for an array of Vector3 |
|
Custom Extension Array type for an array of lins |
|
Custom Extension Array type for an array of fols |
|
Custom Extension Array type for an array of faults |
- class apsg.pandas.Vec3Array(vecs)
Bases:
ExtensionArrayCustom Extension Array type for an array of Vector3
- copy()
Return copy of array
- property dtype
Return Dtype instance (not class) associated with this Array
- isna()
Returns a 1-D array indicating if each value is missing
- property nbytes
The number of bytes needed to store this object in memory.
- take(indices, *, allow_fill=False, fill_value=None)
Take element from array using positional indexing
- class apsg.pandas.LinArray(lins)
Bases:
Vec3ArrayCustom Extension Array type for an array of lins
- property dtype
Return Dtype instance (not class) associated with this Array