Skip to content

Missing entrys in bool column are replaced with "None" (DataFrame) #550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
flyingdodo11 opened this issue Jan 5, 2023 · 1 comment · Fixed by #584
Closed

Missing entrys in bool column are replaced with "None" (DataFrame) #550

flyingdodo11 opened this issue Jan 5, 2023 · 1 comment · Fixed by #584
Assignees
Labels
bug Something isn't working
Milestone

Comments

@flyingdodo11
Copy link

Specifications

  • Client Version: 1.35
  • InfluxDB Version: 2.6
  • Platform: Linux

Code sample to reproduce problem

                    |> range(start: {start_time}, stop: {end_time}) \
                    |> filter(fn: (r) => r._measurement == "{m}" ) \
                    |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value") \
                    |> group() \
                    |> sort(columns: ["_time"], desc: false) \
                    |> drop(columns: ["_start", "_stop", "_measurement"]) '

                    df = self.query_api.query_data_frame(query=query,data_frame_index=['_time'])

Expected behavior

My Measurement includes many fields and some of them are bool fields. Not every row has a value in every field. I expect that when reading and converting into a dataframe object, the missing entries of the bool columns are occupied as NaN

Actual behavior

However, the missing entries are set as None, which means that my column is no longer of the data type bool, but of the data type string, which leads to errors during further processing.

See here:

<style> </style>
_time Temp Error Control
2022-05-13 09:25:21.243512+00:00 80.3 None None
2022-05-13 09:25:21.296167+00:00 NaN False None
2022-05-13 09:25:21.306052+00:00  26 NaN None True

Datatypes:

Temp float64
Error object
Control object

Additional info

No response

@flyingdodo11 flyingdodo11 added the bug Something isn't working label Jan 5, 2023
@flyingdodo11 flyingdodo11 changed the title Missing entrys in bool column are replaced with "None" Missing entrys in bool column are replaced with "None" (DataFrame) Jan 5, 2023
@bednar bednar self-assigned this Jun 20, 2023
@bednar
Copy link
Contributor

bednar commented Jun 20, 2023

Hi @flyingdodo11,

I have prepared a fixed version within #584. Development version of the client will be available after #584 acceptance, stable version in regular release cycle.

You could use a fixed version by:

pip install git+https://github.com/influxdata/influxdb-client-python.git@pandas-query-bools

Regards

@bednar bednar added this to the 1.35.0 milestone Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants