Skip to content
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

fix: DataFrame write shows Future Warning. #611

Merged
merged 2 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Bug Fixes
1. [#601](https://github.com/influxdata/influxdb-client-python/pull/601): Use HTTResponse.headers to clear deprecation warning [urllib3]
1. [#610](https://github.com/influxdata/influxdb-client-python/pull/601): Use iloc to clear deprecation warning

### Documentation
1. [#566](https://github.com/influxdata/influxdb-client-python/pull/566): Fix Sphinx documentation build and add support `.readthedocs.yml` V2 configuration file
Expand Down
8 changes: 4 additions & 4 deletions influxdb_client/client/write/dataframe_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def __init__(self, data_frame, point_settings, precision=DEFAULT_WRITE_PRECISION

if key in data_frame_tag_columns:
# This column is a tag column.
if null_columns[index]:
if null_columns.iloc[index]:
key_value = f"""{{
'' if {val_format} == '' or type({val_format}) == float and math.isnan({val_format}) else
f',{key_format}={{str({val_format}).translate(_ESCAPE_STRING)}}'
Expand All @@ -197,12 +197,12 @@ def __init__(self, data_frame, point_settings, precision=DEFAULT_WRITE_PRECISION
elif issubclass(value.type, np.bool_):
field_value = f'{sep}{key_format}={{{val_format}}}'
elif issubclass(value.type, np.floating):
if null_columns[index]:
if null_columns.iloc[index]:
field_value = f"""{{"" if math.isnan({val_format}) else f"{sep}{key_format}={{{val_format}}}"}}"""
else:
field_value = f'{sep}{key_format}={{{val_format}}}'
else:
if null_columns[index]:
if null_columns.iloc[index]:
field_value = f"""{{
'' if type({val_format}) == float and math.isnan({val_format}) else
f'{sep}{key_format}="{{str({val_format}).translate(_ESCAPE_STRING)}}"'
Expand Down Expand Up @@ -239,7 +239,7 @@ def __init__(self, data_frame, point_settings, precision=DEFAULT_WRITE_PRECISION
self.data_frame = data_frame
self.f = f
self.field_indexes = field_indexes
self.first_field_maybe_null = null_columns[field_indexes[0] - 1]
self.first_field_maybe_null = null_columns.iloc[field_indexes[0] - 1]

#
# prepare chunks
Expand Down
Loading