Skip to content

Commit

Permalink
Merge pull request #239 from gavargas22/fix/curve_deprecated_access
Browse files Browse the repository at this point in the history
Fix/curve deprecated access
  • Loading branch information
frank1010111 authored Nov 29, 2024
2 parents 5a01e77 + b055b3e commit facad63
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions welly/curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import numpy as np
import pandas as pd
from pandas.api.types import is_any_real_numeric_dtype
from scipy.interpolate import interp1d

from welly.plot import plot_2d_curve, plot_curve, plot_kde_curve
Expand Down Expand Up @@ -367,15 +368,15 @@ def _repr_html_(self):
# Curve preview.
s = '<tr><th style="border-top: 2px solid #000;">Depth</th><th style="border-top: 2px solid #000;">Value</th></tr>'
rows += s.format(self.start, self.df.values[0][0])
if self.dtypes[0] == float:
if self.dtypes.iloc[0] == float:
s = '<tr><td>{:.4f}</td><td>{:.4f}</td></tr>'
else:
s = '<tr><td>{}</td><td>{}</td></tr>'
for depth, value in self.df.iloc[:3].iterrows():
rows += s.format(depth, value[0])
rows += s.format(depth, value.iloc[0])
rows += '<tr><td>⋮</td><td>⋮</td></tr>'
for depth, value in self.df.iloc[-3:].iterrows():
rows += s.format(depth, value[0])
rows += s.format(depth, value.iloc[0])

# Footer.
# ...
Expand Down Expand Up @@ -509,7 +510,7 @@ def step(self):
0. If the index is numeric and not equally sampled
None. If the index is not numeric
"""
if self.df.index.is_numeric() and not self.df.index.empty:
if is_any_real_numeric_dtype(self.df.index) and not self.df.index.empty:
return get_step_from_array(self.df.index.values)
else:
return None
Expand Down

0 comments on commit facad63

Please sign in to comment.