All endpoints which support paging have an autopaging flag which may be set to true in order to sequentially
fetch all resources. If for some reason, you want to do this manually, you may use the next_cursor() method on
the response object. Here is an example of that:

fromcognite.clientimportCogniteClient,APIErrorclient=CogniteClient()try:client.login.status()exceptAPIErrorase:ife.code==401:print("You are not authorized")elife.code==400:print("Something is wrong with your request")elife.code==500:print("Something went terribly wrong. Here is the request-id: {}".format(e.x_request_id)print("The message returned from the API: {}".format(e.message))

Returns a DatapointsObject containing a list of datapoints for the given query.

This method will automate paging for the user and return all data for the given time period.

Parameters:

name (str) – The name of the timeseries to retrieve data for.

start (Union[str, int, datetime]) – Get datapoints after this time. Format is N[timeunit]-ago where timeunit is w,d,h,m,s.
E.g. ‘2d-ago’ will get everything that is up to 2 days old. Can also send time in ms since
epoch or a datetime object which will be converted to ms since epoch UTC.

end (Union[str, int, datetime]) – Get datapoints up to this time. Same format as for start.

Returns a pandas dataframe of datapoints for the given timeseries all on the same timestamps.

This method will automate paging for the user and return all data for the given time period.

Parameters:

time_series (list) – The list of timeseries names to retrieve data for. Each timeseries can be either a string
containing the timeseries or a dictionary containing the names of thetimeseries and a
list of specific aggregate functions.

aggregates (list) – The list of aggregate functions you wish to apply to the data for which you have not
specified an aggregate function. Valid aggregate functions are: ‘average/avg, max, min,
count, sum, interpolation/int, stepinterpolation/step’.

granularity (str) – The granularity of the aggregate values. Valid entries are : ‘day/d, hour/h, minute/m,
second/s’, or a multiple of these indicated by a number as a prefix e.g. ‘12hour’.

start (Union[str, int, datetime]) – Get datapoints after this time. Format is N[timeunit]-ago where timeunit is w,d,h,m,s.
E.g. ‘2d-ago’ will get everything that is up to 2 days old. Can also send time in ms since
epoch or a datetime object which will be converted to ms since epoch UTC.

end (Union[str, int, datetime]) – Get datapoints up to this time. Same format as for start.

Keyword Arguments:

limit (str) – Max number of rows to return. If limit is specified, this method will not automate
paging and will return a maximum of 100,000 rows.

workers (int) – Number of download workers to run in parallell. Defaults to 10.

Returns:

A pandas dataframe containing the datapoints for the given timeseries. The datapoints for all the
timeseries will all be on the same timestamps.

start (Union[str, int, datetime]) – Get datapoints after this time. Format is N[timeunit]-ago where timeunit is w,d,h,m,s.
E.g. ‘2d-ago’ will get everything that is up to 2 days old. Can also send time in ms since
epoch or a datetime object which will be converted to ms since epoch UTC.

end (Union[str, int, datetime]) – Get datapoints up to this time. Same format as for start.

Write a dataframe.
The dataframe must have a ‘timestamp’ column with timestamps in milliseconds since epoch.
The names of the remaining columns specify the names of the time series to which column contents will be written.
Said time series must already exist.

client=CogniteClient()ts_name='NOISE'start=datetime(2018,1,1)# The scaling by 1000 is important: timestamp() returns secondsx=[(start+timedelta(days=d)).timestamp()*1000fordinrange(100)]y=np.random.normal(0,1,100)# The time column must be called precisely 'timestamp'df=pd.DataFrame({'timestamp':x,ts_name:y})client.datapoints.post_datapoints_frame(df)

aggregates (list) – The aggregate functions to be returned. Use default if null. An empty string must
be sent to get raw data if the default is a set of aggregate functions.

granularity (str) – The granularity size and granularity of the aggregates.

start (str, int, datetime) – Get datapoints after this time. Format is N[timeunit]-ago where timeunit is w,d,h,m,s.
Example: ‘2d-ago’ will get everything that is up to 2 days old. Can also send time in
ms since epoch or as a datetime object.

end (str, int, datetime) – Get datapoints up to this time. The format is the same as for start.

Returns a DatapointsObject containing a list of datapoints for the given query.

This method will automate paging for the user and return all data for the given time period.

Parameters:

id (int) – The unique id of the timeseries to retrieve data for.

start (Union[str, int, datetime]) – Get datapoints after this time. Format is N[timeunit]-ago where timeunit is w,d,h,m,s.
E.g. ‘2d-ago’ will get everything that is up to 2 days old. Can also send time in ms since
epoch or a datetime object which will be converted to ms since epoch UTC.

end (Union[str, int, datetime]) – Get datapoints up to this time. Same format as for start.