Skip to content

Commit a808559

Browse files
committed
[ENH] Removed the pandas hard dependency for sections grid
1 parent 44d3f1b commit a808559

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

gempy/core/data/geo_model.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from .surface_points import SurfacePointsTable
2525
from ...modules.data_manipulation.engine_factory import interpolation_input_from_structural_frame
2626

27-
import pandas as pd
2827

2928
"""
3029
TODO:
@@ -299,7 +298,6 @@ def add_surface_points(self, X: Sequence[float], Y: Sequence[float], Z: Sequence
299298
use_enum_values=False,
300299
json_encoders={
301300
np.ndarray: encode_numpy_array,
302-
pd.DataFrame: lambda df: df.to_dict(orient="list"),
303301
}
304302
)
305303

gempy/core/data/grid_modules/sections_grid.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1+
from __future__ import annotations # Python 3.7+ only
12
import dataclasses
23
import numpy as np
34
from pydantic import Field
4-
from typing import Tuple, Dict, List, Optional
5+
from typing import Tuple, Dict, List, Optional, Any
56

67
from ..core_utils import calculate_line_coordinates_2points
78
from ..encoders.converters import short_array_type
89
from ....optional_dependencies import require_pandas
910

10-
try:
11-
import pandas as pd
12-
except ImportError:
13-
pandas = None
1411

1512

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

0 commit comments

Comments
 (0)