Skip to main content
Answer

Ingesting timeseries issue

  • January 10, 2025
  • 2 replies
  • 33 views

Forum|alt.badge.img+3

I can not update (push) the existing timeseries by client.time_series.data.insert() method.

data_points = [{'timestamp':pd.to_datetime(df5.index[i]).timestamp()*1000,'value':df5['My Feature'].iloc[i]} for i in range(len(df5))]

client.time_series.data.insert(data_points, external_id=external_id_feature)

The way I followed is : trim the specific date-range, insert the timeseries.

Is there any standard way to update the existing time-series ??

Best answer by Håkon V. Treider

What error do you encounter?

The SDK documentation lists two ways to insert datapoints, either as a list of tuples or a list of dictionaries. Check it out here: https://cognite-sdk-python.readthedocs-hosted.com/en/latest/time_series.html#cognite.client._api.datapoints.DatapointsAPI.insert

If you want to insert directly from a pandas DataFrame, you can do so. Check out the documentation here: https://cognite-sdk-python.readthedocs-hosted.com/en/latest/time_series.html#insert-pandas-dataframe

2 replies

Forum|alt.badge.img

What error do you encounter?

The SDK documentation lists two ways to insert datapoints, either as a list of tuples or a list of dictionaries. Check it out here: https://cognite-sdk-python.readthedocs-hosted.com/en/latest/time_series.html#cognite.client._api.datapoints.DatapointsAPI.insert

If you want to insert directly from a pandas DataFrame, you can do so. Check out the documentation here: https://cognite-sdk-python.readthedocs-hosted.com/en/latest/time_series.html#insert-pandas-dataframe


Forum|alt.badge.img
  • Seasoned Practitioner
  • January 10, 2025

@Ankit Kothawade ,
Håkon’s advice should work.  If not, it would be helpful to share some code samples with the error your are receiving to help debug your issue.

 

Regards,
Jason