Skip to main content

dear all 

I was attempting to perform data aggregation based on the date. I am retrieving online data into CDF, which is updated every 2-3 minutes. I am trying to aggregate the data so that the date is updated every 24 hours instead of every 2-4 minutes.
I used this code to obtain the list of columns in my data frame.

# Check the structure of the DataFrame, including column names and the first few rows
print(dp.columns)  # This will show all column names
dp.head()          # This will show the first few rows of the DataFrame 

however, I got only this after running the code 

I tried to use another code again the first column is not date column. 

 

Hi
Yes, you can aggregate based on the date!
https://cognite-sdk-python.readthedocs-hosted.com/en/latest/time_series.html#cognite.client._api.datapoints.DatapointsAPI.retrieve_dataframe

If you set the granularity parameter to “1d”, and the aggregates parameter to the kind of aggregate(s) you want, you will retrieve daily data points aggregates instead of every individual data point. There are also a few examples in the SDK documentation I linked to above.

By default, it will group the data from midnight to next midnight in the UTC time zone, but this can be changed using the timezone parameter.
Hope this helps :)

Matias


Reply