Overview - DataFrames
For Data Scientists, a common format for storing and managing data in Python is using Pandas DataFrames.
Kelvin has a convenient function to convert your Kelvin data into a Pandas DataFrame.
data.to_df()
Example
Here is a simple example to retrieve data from the Kelvin Platform and convert it into a Pandas DataFrame for further analysis and manipulation.
from kelvin.api.client import Client
# Login
client = Client(config={"url": "https://<url.kelvin.ai>", "username": "<your_username>"})
client.login(password="<your_password>")
# Get Time Series Data
response = client.timeseries.get_timeseries_range(
data={
"start_time": "2024-04-18T12:00:00.000000Z",
"end_time": "2024-04-19T12:00:00.000000Z",
"selectors": [
{
"resource": "krn:ad:pcp_01/casing_pressure",
}
]
}
)
# Convert the response into a Pandas DataFrame
df = response.to_df()
# Print the result
print(df)