Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[ENH] Removed the pandas hard dependency for sections grid
  • Loading branch information
Leguark committed May 25, 2025
commit a808559111c851324871ef32fe686d415edace76
2 changes: 0 additions & 2 deletions gempy/core/data/geo_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from .surface_points import SurfacePointsTable
from ...modules.data_manipulation.engine_factory import interpolation_input_from_structural_frame

import pandas as pd

"""
TODO:
Expand Down Expand Up @@ -299,7 +298,6 @@ def add_surface_points(self, X: Sequence[float], Y: Sequence[float], Z: Sequence
use_enum_values=False,
json_encoders={
np.ndarray: encode_numpy_array,
pd.DataFrame: lambda df: df.to_dict(orient="list"),
}
)

Expand Down
9 changes: 3 additions & 6 deletions gempy/core/data/grid_modules/sections_grid.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
from __future__ import annotations # Python 3.7+ only
import dataclasses
import numpy as np
from pydantic import Field
from typing import Tuple, Dict, List, Optional
from typing import Tuple, Dict, List, Optional, Any

from ..core_utils import calculate_line_coordinates_2points
from ..encoders.converters import short_array_type
from ....optional_dependencies import require_pandas

try:
import pandas as pd
except ImportError:
pandas = None


@dataclasses.dataclass
Expand Down Expand Up @@ -46,7 +43,7 @@ class Sections:
resolution: List[Tuple[int, int]] = Field(default_factory=list, exclude=True)
length: np.ndarray = Field(default_factory=lambda: np.array([0]), exclude=True)
dist: np.ndarray = Field(default_factory=lambda: np.array([]), exclude=True)
df: Optional[pd.DataFrame] = Field(default=None, exclude=True)
df: Optional[Any] = Field(default=None, exclude=True)
values: np.ndarray = Field(default_factory=lambda: np.empty((0, 3)), exclude=True)
extent: Optional[np.ndarray] = Field(default=None, exclude=True)

Expand Down