Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nonzero value error in _bool_is_same -> series inputs #3

Open
jzmejia opened this issue Nov 25, 2020 · 1 comment
Open

nonzero value error in _bool_is_same -> series inputs #3

jzmejia opened this issue Nov 25, 2020 · 1 comment
Assignees

Comments

@jzmejia
Copy link
Owner

jzmejia commented Nov 25, 2020

Passing a series (empty) to is same. Need work around

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-39-6176c7133a7e> in <module>
      1 eorm_vel = c_rolling(c_rolling(eorm17.vel,'6H',min_periods=100)['2017-8-5':'2017-8-20'],'6H').dropna()
      2 
----> 3 eorm17_diurnal = DiurnalExtrema(eorm_vel,generate_figure=True)

~/WorkingDir/GrIS/X_PYTHON-CODES/datatools/diurnal.py in __init__(self, timeseries, minfirst, maxnextday, predictTiming, window, threshold, generate_figure, stn, **kwargs)
    161         self.diurnal_vals = []
    162 
--> 163         self.df = self.find_diurnal_extrema()
    164         if self.generate_figure:
    165             self.plot()

~/WorkingDir/GrIS/X_PYTHON-CODES/datatools/diurnal.py in find_diurnal_extrema(self)
    227             else:
    228                 # find diurnal minimum
--> 229                 minVal, minTime = self.get_real_extrema(
    230                     self.timeseries, day, 'min')
    231                 if self.minfirst and self.maxnextday:

~/WorkingDir/GrIS/X_PYTHON-CODES/datatools/diurnal.py in get_real_extrema(self, ts, window, min_or_max)
    374             extremaTuple = self.get_extrema(
    375                 ts[window[0]:window[1]], min_or_max)
--> 376             if not on_boundary(ts, window, extremaTuple, min_or_max):
    377                 extremaTuple = (None, None)
    378         return extremaTuple

~/WorkingDir/GrIS/X_PYTHON-CODES/datatools/diurnal.py in on_boundary(timeseries, window, extrema_tuple, val_type)
    525                 bound = get_index_of_bound(
    526                     timeseries, window, start_or_end[idx])
--> 527             if _bool_is_same(bound, extrema_time):
    528                 boundary_ok = bool_check_around_bound(timeseries, bound,
    529                                                       extrema_tuple, val_type)

~/WorkingDir/GrIS/X_PYTHON-CODES/datatools/diurnal.py in _bool_is_same(val1, val2)
    417 
    418 def _bool_is_same(val1, val2):
--> 419     return True if val1 == val2 else False
    420 
    421 

~/WorkingDir/GrIS/X_PYTHON-CODES/move/lib/python3.8/site-packages/pandas/core/generic.py in __nonzero__(self)
   1327 
   1328     def __nonzero__(self):
-> 1329         raise ValueError(
   1330             f"The truth value of a {type(self).__name__} is ambiguous. "
   1331             "Use a.empty, a.bool(), a.item(), a.any() or a.all()."

ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
@jzmejia jzmejia self-assigned this Nov 25, 2020
@jzmejia
Copy link
Owner Author

jzmejia commented Nov 25, 2020

You can not currently pass timeseries with dtype pd.DataFrame, only accepts pd.Series timeseries data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant