davemlz / eemont

A python package that extends Google Earth Engine.
https://eemont.readthedocs.io/
MIT License
407 stars 69 forks source link

convert datetime in R #38

Closed Joy-Giovanni closed 3 years ago

Joy-Giovanni commented 3 years ago

in the tutorial of timeseries by regions there is this line to convert date to datetime

tsPandas['date'] = pd.to_datetime(tsPandas['date'],infer_datetime_format = True)

I am trying to run it in R and getting this error: Error in py_call_impl(callable, dots$args, dots$keywords) : ValueError: to assemble mappings requires at least that [year, month, day] be specified: [day,month,year] is missing.

how can I solve this?

davemlz commented 3 years ago

Hi, @Joy-Giovanni!

Well, it is not recommended to use this tutorial in R since it uses more python modules than just eemont: geemap, pandas, seaborn, and some calls to the functions of these modules may fail in the middle.

My suggestion: you can do everything that just uses eemont, so, you can use everything until the getTimeSeriesByRegion method, but don't continue afterwards (don't convert to pandas and don't plot it). Here, you can use rgee to convert the ee.FeatureCollection to a sf object (check the ee_as_sf function of rgee) and try to do everything using R packages :)

I hope it works!