influxdb-client-python icon indicating copy to clipboard operation
influxdb-client-python copied to clipboard

Pandas outputs warning when calling dataframe.append in flux_csv_parser._prepare_data_frame

Open jonashoechst opened this issue 1 year ago • 5 comments

Specifications

  • Client Version: 1.36.0
  • InfluxDB Version: 2.7

Code sample to reproduce problem

query_api.query_data_frame(query)

Expected behavior

The query should be executed without warnings.

Actual behavior

Pandas outputs a FutureWarning:

/usr/local/lib/python3.11/site-packages/influxdb_client/client/flux_csv_parser.py:256: FutureWarning:
The behavior of array concatenation with empty entries is deprecated. In a future version, this will no longer exclude empty items when determining the result dtype. To retain the old behavior, exclude the empty entries before the concat operation.

This is related to the this code snippet:

https://github.com/influxdata/influxdb-client-python/blob/aa6e5c4aad1aaf004195c175ebe424ac6040c2e3/influxdb_client/client/flux_csv_parser.py#L243C9-L256

Additional info

In the recent pandas version handling of concatenation of empty dataframes changed, see https://github.com/pandas-dev/pandas/issues/39122. This should be handled else wise to reflect the changes in pandas.

jonashoechst avatar Sep 19 '23 14:09 jonashoechst

I wasn't able to replicate this issue. I have tried to run this with 2.0.3 and 2.1.1 pandas with no warning. Could you provide more information (query, data etc.) ?

Sciator avatar Oct 26 '23 11:10 Sciator

@sciator, this warning is a part of the Pandas 2.1. For more info see:

  • https://github.com/pandas-dev/pandas/pull/52532
  • https://github.com/pandas-dev/pandas/issues/39122
  • https://github.com/pandas-dev/pandas/blob/0cbe41ad0bab42fa6fc8694adcf6db3804447740/pandas/core/dtypes/concat.py#L115

On 26. 10. 2023, at 13:35, Sciator @.***> wrote:

I wasn't able to replicate this issue. I have tried to run this with 2.0.3 and 2.1.1 pandas with no warning. Could you provide more information (query, data etc.) ?

— Reply to this email directly, view it on GitHub https://github.com/influxdata/influxdb-client-python/issues/613#issuecomment-1780940139, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADPDYJENWP2Z4PVRRNUCLTYBJDIPAVCNFSM6AAAAAA46NILZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBQHE2DAMJTHE. You are receiving this because you are subscribed to this thread.

bednar avatar Oct 26 '23 17:10 bednar

pls, it would be great if we have data and the query to reproduce, before we can go on with this issue

ivankudibal avatar Nov 21 '23 09:11 ivankudibal