Select to view content in your preferred language

Calculate number of days in date attribute?

03-27-2023 07:51 AM
Occasional Contributor

I have a dataset that contains a date attribute and records show date/time. How can I count then number of unique dates while disregarding the time stamp? 

0 Kudos
1 Reply
MVP Esteemed Contributor

If you can load your data into a pandas DataFrame (a "GeoAccessor" in the Python API), it's simple:

from arcgis.features import GeoAccessor

# load layer into dataframe
df = GeoAccessor.from_featureclass('path/to/fc')

# create new date field, dropping time
df['the_date'] = df['your_datetime_field']

# get the count


- Josh Carlson
Kendall County GIS
0 Kudos