I am currently on ArcGIS Pro 3.3 and I am learning how to make a line chart through a Spatially Exported Data Frame (SEDF) using their ArcGIS Pro Python API, but I keep getting an error from using the .set_index object.
import pandas as pd
from arcgis.features import GeoAccessor, GeoSeriesAccessor
import matplotlib.pyplot as plt
# add the magic command to keep charts inline
%matplotlib inline
sedf = pd.DataFrame.spatial.from_featureclass(r'G:\share_file\avargas\Esri Training\VisualPythonAPI\VisualPythonAPI\FirePoints.gdb\FireEvents_MT')
wildfires_df = sedf[sedf["CauseCat"] == "Natural"]
wildfires_by_month = wildfires_df.set_index("StartDate").groupby(pd.Grouper(freq='M')).count()
What exactly is the error you're getting? Can you paste the full text?
When you make a Grouper object, try explicitly stating the key. I don't really understand why the index is being set prior to grouping.
wildfires_by_month = wildfires_df.groupby(pd.Grouper(freq='M', key='StartDate')).count()
This is a screenshot of the error I am getting:
I'm really just following an online lesson plan, but it is clearly outdated. I tried using the line of code you suggested but nothing really changed, I get the same exact error.