# PANDAS-format not working

**URL:** https://community.cumulocity.com/t/pandas-format-not-working/1403
**Category:** Forum
**Tags:** cumulocity, datahub
**Created:** [June 24, 2024, 1:38pm UTC](https://community.cumulocity.com/t/pandas-format-not-working/1403 "2024-06-24T13:38:24Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![David.Richter](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@David.Richter](https://community.cumulocity.com/u/David.Richter)
#### Post date: [June 24, 2024, 1:38pm UTC](https://community.cumulocity.com/t/pandas-format-not-working/1403/1 "2024-06-24T13:38:24Z")

</div>

After I failed with my attemt to established a JDBC [Connection to DateHub](https://community.cumulocity.com/t/jdbc-connection-to-datahub/7696/1) I try to use the datehub Microservice instead.

I try to use the datahub microservice to query the data.I use the “High-performance API” which have the format-option (as the doc say [Cumulocity IoT DataHub - OpenAPI Specification](https://cumulocity.com/api/datahub/#operation/postPerformanceSQLApiResource)). In reality the parameter do nothing. I send as `format: "PANDAS"` but the result I get back look like the default forma, what is awkward to parse.

My Query:  
`{"sql":"SELECT * FROM txxxxxxxxDataLake.\"pw-hmi\".txxxxxxxx.\"measurements_State_Offline\" WHERE source=241481197242","limit":1,"format":"PANDAS"}`

The result have this format:

```auto
{
   "columns":[
      "dir0",
      "dir1",
      "dir2",
      "dir3",
      "id",
      "creationTime",
      "creationTimeOffset",
      "creationTimeWithOffset",
      "YEAR",
      "MONTH",
      "DAY",
      "time",
      "timeOffset",
      "timeWithOffset",
      "source",
      "type",
      "Activity_Idle.series_times.unit",
      "Activity_Idle.series_times.value"
   ],
   "data":[
      [
         "chunk_P1_598_618_1701302400000_1701561600000_46597706",
         "0_2023",
         "0_11",
         "0_30",
         "1343464808",
         "2023-11-30T05:53:44.532",
         0,
         "2023-11-30T05:53:44.532",
         "2023",
         "11",
         "30",
         "2023-11-30T05:53:13.966",
         0,
         "2023-11-30T05:53:13.966",
         "881342014107",
         "Activity_Idle",
         "sec",
         147915.0
      ]
   ]
}

```

The PANDAS-Format from the documentation looks much cleaner and better to parse with normal object mapper.

---

<div class="post-metadata">

### Author: ![Vachaspati\_Diwevedi2](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/vachaspati_diwevedi2/32/1256_2.png) [@Vachaspati\_Diwevedi2](https://community.cumulocity.com/u/Vachaspati_Diwevedi2)
#### Post date: [June 25, 2024, 10:03am UTC](https://community.cumulocity.com/t/pandas-format-not-working/1403/2 "2024-06-25T10:03:51Z")

</div>

Hi @David.Richter As per the API documentation it providing the right result set.  
If the format is “DREMIO” the result set must have “Schema”, “rows” & “rowcount” like below

{

- “schema”:[

- “rows”:[

- “rowCount”: 5

}

If format is “PANDAS” result set must have columns and data only

{

- “columns”:[

- “data”:[

}

In your API response you are getting the columns and list of data (records).  
Is your requirement is to do some additional data formatting?

---

<div class="post-metadata">

### Author: ![David.Richter](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@David.Richter](https://community.cumulocity.com/u/David.Richter)
#### Post date: [June 26, 2024, 6:07am UTC](https://community.cumulocity.com/t/pandas-format-not-working/1403/3 "2024-06-26T06:07:07Z")

</div>

Hi @Vachaspati_Diwevedi2

as you can see in my example response I get the result in DREMIO-format even I send `"format":"PANDAS"` in my request.  
I want use the PANDAS-format because its easier to use. When I see the example here [Cumulocity IoT DataHub - OpenAPI Specification](https://cumulocity.com/api/datahub/#operation/postPerformanceSQLApiResource) it look like I get a complete objects in data that I can parse with ObjectMapper in my code. And unter columns I get information about the data type. In The DREMIO-format I don’t have information about the data types.

I build now a complex code to working with the DREMIO-format but I don’t understand why I can’t use the better PANDAS-format.

---

<div class="post-metadata">

### Author: ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)
#### Post date: [December 20, 2024, 11:12pm UTC](https://community.cumulocity.com/t/pandas-format-not-working/1403/4 "2024-12-20T23:12:12Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)
#### Post date: [June 18, 2025, 11:12pm UTC](https://community.cumulocity.com/t/pandas-format-not-working/1403/5 "2025-06-18T23:12:47Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
