-
Notifications
You must be signed in to change notification settings - Fork 7
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
Not compatible with pandas >= 0.19.0 #87
Comments
oh wild, where does it use it? probably the easiest fix is to convert to numpy before the reshape. |
Thanks @pgkirsch. Do you have a simple test or example that produces this issue? |
I was mistaken. Example is if we make one of the input arrays for from numpy import log, exp, log10, vstack
from gpfit.fit import fit
from numpy.random import random_sample
import pandas as pd
Vdd = pd.Series(random_sample(1000,) + 1)
Vth = 0.2*random_sample(1000,) + 0.2
P = Vdd**2 + 30*Vdd*exp(-(Vth-0.06*Vdd)/0.039)
u = vstack((Vdd,Vth))
x = log(u)
y = log(P)
K = 4
cstrt, rmsErr = fit(x, y, K, "ISMA") yields ---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~/Optimization/gpfit/gpfit/examples/pd.py in <module>
12 K = 4
13
---> 14 cstrt, rmsErr = fit(x,y,K,"ISMA")
~/Optimization/gpfit/gpfit/fit.py in fit(xdata, ydata, K, ftype)
78 fitdata["ub%d" % i] = exp(max(xdata.T[i]))
79
---> 80 params = get_params(ftype, K, xdata, ydata)
81
82 # A: exponent parameters, B: coefficient parameters
~/Optimization/gpfit/gpfit/fit.py in get_params(ftype, K, xdata, ydata)
23 return r, drdp
24
---> 25 ba = ba_init(xdata, ydata.reshape(ydata.size, 1), K).flatten('F')
26
27 if ftype == "ISMA":
/opt/anaconda3/lib/python3.8/site-packages/pandas/core/generic.py in __getattr__(self, name)
5137 if self._info_axis._can_hold_identifiers_and_holds_name(name):
5138 return self[name]
-> 5139 return object.__getattribute__(self, name)
5140
5141 def __setattr__(self, name: str, value) -> None:
AttributeError: 'Series' object has no attribute 'reshape' I agree with @bqpd's suggestion to make sure all input arrays are numpy arrays as a pre-process step. |
Or make it a ux change and raise an error if the input type isn't a numpy array. |
fit.py
usespandas.Series.reshape
, which, per the pandas docs has been deprecated since pandas 0.19.0:https://pandas.pydata.org/pandas-docs/version/0.22/generated/pandas.Series.reshape.html
The text was updated successfully, but these errors were encountered: