pyet-org / pyet

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

methods don't work with Pandas DataFrame #39

Open raoulcollenteur opened 2 years ago

raoulcollenteur commented 2 years 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 2 years 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 12 months ago

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