pyet-org / pyet

:sunflower: pyet is a Python package to estimate reference and potential evaporation.
https://pyet.readthedocs.io/
MIT License
130 stars 33 forks source link

methods don't work with Pandas DataFrame #39

Open raoulcollenteur opened 1 year ago

raoulcollenteur commented 1 year ago

I think the methods are not tested for pandas.DataFrame, and actually don't work for this data yet. Running the following code with dataframes gives an error:

et = pyet.hargreaves(tmean, tmax, tmin, lat=lat)

TypeError: 'str' object is not callable

I think caused by this line:

--> 192 return pe.rename("Hargreaves")

mvremec commented 1 year ago

At this point, PyEt is working only with Pandas.Series and xarray.DataArray. We do not state anywhere that you can also use pandas.DataFrame. We can think about extending PyEt to DataFrames, however, there are some challenges in doing so:

  1. rename function works with pandas.Series and xarray.DataArray, but not with pandas.DataFrame.
  2. NumPy functions (max, min, mean, ...) used on pandas.Series and xarray.DataArray return a Float/Int. With pandas.DataFrame, they return a pandas.Series.

In short, I can not think of a simple and fast solution so that PyEt also works with pandas.DataFrames.

raoulcollenteur commented 11 months ago

Note to self, document use of Pandas Apply function in the examples to do this.