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:

>>> 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],
... })

Now use the fol accessor to retrieve the underlying APSG feature set:

>>> df.fol()              # FeatureSet from the fols column
>>> df.fol().fisher_statistics()["k"]   # Fisher precision parameter
>>> df.fol().ortensor()   # Orientation tensor

The same approach works for linear features using lin accessor:

>>> df.lin()
>>> df.lin().fisher_statistics()

If your columns have different names as default azi and inc, use set_columns method:

>>> df.lin.set_columns(azi="trend", inc="plunge")()
>>> df.lin.set_columns(azi="trend", inc="plunge").plot()

Classes:

Vec3Array(data[, mask])

Custom Extension Array type for an array of Vector3.

Vec2Array(data[, mask])

Custom Extension Array type for an array of Vector2.

LinArray(data[, mask])

Custom Extension Array type for an array of lins.

FolArray(data[, mask])

Custom Extension Array type for an array of fols.

FaultArray(data[, mask])

Custom Extension Array type for an array of faults.

DirArray(data[, mask])

Custom Extension Array type for an array of directions.

VecAccessor(pandas_obj)

Callable DataFrame accessor for Vector3 data.

Vec2Accessor(pandas_obj)

Callable DataFrame accessor for Vector2 data.

DirAccessor(pandas_obj)

Callable DataFrame accessor for Direction data.

FolAccessor(pandas_obj)

Callable DataFrame accessor for Foliation data.

LinAccessor(pandas_obj)

Callable DataFrame accessor for Lineation data.

FaultAccessor(pandas_obj)

Callable DataFrame accessor for Fault data.

class apsg.pandas.Vec3Array(data, mask=None)[source]#

Bases: _MaskedFeatureArray

Custom Extension Array type for an array of Vector3.

property dtype#

Return Dtype instance (not class) associated with this Array.

class apsg.pandas.Vec2Array(data, mask=None)[source]#

Bases: _MaskedFeatureArray

Custom Extension Array type for an array of Vector2.

property dtype#

Return Dtype instance (not class) associated with this Array.

class apsg.pandas.LinArray(data, mask=None)[source]#

Bases: _MaskedFeatureArray

Custom Extension Array type for an array of lins.

property dtype#

Return Dtype instance (not class) associated with this Array.

class apsg.pandas.FolArray(data, mask=None)[source]#

Bases: _MaskedFeatureArray

Custom Extension Array type for an array of fols.

property dtype#

Return Dtype instance (not class) associated with this Array.

class apsg.pandas.FaultArray(data, mask=None)[source]#

Bases: _MaskedFeatureArray

Custom Extension Array type for an array of faults.

property dtype#

Return Dtype instance (not class) associated with this Array.

class apsg.pandas.DirArray(data, mask=None)[source]#

Bases: _MaskedFeatureArray

Custom Extension Array type for an array of directions.

property dtype#

Return Dtype instance (not class) associated with this Array.

class apsg.pandas.VecAccessor(pandas_obj)[source]#

Bases: _FeatureAccessor

Callable DataFrame accessor for Vector3 data. Default columns x, y, z.

class apsg.pandas.Vec2Accessor(pandas_obj)[source]#

Bases: _FeatureAccessor

Callable DataFrame accessor for Vector2 data. Default columns x, y.

class apsg.pandas.DirAccessor(pandas_obj)[source]#

Bases: _FeatureAccessor

Callable DataFrame accessor for Direction data. Default column angle.

class apsg.pandas.FolAccessor(pandas_obj)[source]#

Bases: _FeatureAccessor

Callable DataFrame accessor for Foliation data. Default columns azi, inc.

class apsg.pandas.LinAccessor(pandas_obj)[source]#

Bases: _FeatureAccessor

Callable DataFrame accessor for Lineation data. Default columns azi, inc.

class apsg.pandas.FaultAccessor(pandas_obj)[source]#

Bases: _FeatureAccessor

Callable DataFrame accessor for Fault data.

Default columns fazi, finc, lazi, linc, sense.