This repository was archived by the owner on Oct 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 524
Drop pandas DataFrame NaN values for json protocol #587
Closed
Closed
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
75d7fe8
Add _to_dict_drop_na function and use it in _convert_dataframe_to_json
tux-00 8c20ea3
Satisfy flake8
tux-00 119844a
Add dropna on tag columns
tux-00 2c15587
Change to_dict orient param to original value
tux-00 36fc27a
Merge branch 'master' into master
tux-00 61d6b89
Merge branch 'master' into master
xginn8 fe9203b
Add nan values insertion test
tux-00 25272aa
Add numpy to test requirements
tux-00 188269c
Revert last commit
tux-00 ecb3e18
Merge remote-tracking branch 'upstream/master'
tux-00 3207216
Remove numpy import
tux-00 112a9ab
Add trick to remove numpy dependency
tux-00 eaf818d
5.2.1 release
aviau 5ad2188
release 5.2.1 in changelog
aviau ec86d39
Unpin setuptools to fix travis (#674)
xginn8 fbfca02
unpin pypy (#682)
clslgrnc f3f890c
Rename all mixedCase globals to snake case to appease N816 (#689)
xginn8 2d17360
Fixup small test docstring typo
xginn8 5147aed
Fix tz localize (#684)
clslgrnc f93010b
Bump version to 5.2.2
xginn8 9fd9d6e
[WIP] add py37 and recent influxdb (#692)
clslgrnc e5d2589
Python and influxdb supported versions (#693)
clslgrnc 170d47e
Add CODEOWNERS file for automatic reviewers on GitHub
xginn8 a3d28f2
Parameter binding for client's `query()` method (#678)
clslgrnc 9e876dc
Add CQs management methods to the client (#681)
lukaszdudek-silvair 6f356f0
Fix a warning under Python 3.7 (#697)
Hanaasagi 15d8231
Update delete_series docstring to differentiate between drop_database…
xginn8 c24d828
add consistency parameter to write_points (#664)
RonRothman a0cd987
Add Example for sending information to DB via UDP (#648)
shantanoo-desai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @aviau @xginn8 @sebito91 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Example for sending batch information to InfluxDB via UDP.""" | ||
|
||
""" | ||
INFO: In order to use UDP, one should enable the UDP service from the | ||
`influxdb.conf` under section | ||
[[udp]] | ||
enabled = true | ||
bind-address = ":8089" # port number for sending data via UDP | ||
database = "udp1" # name of database to be stored | ||
[[udp]] | ||
enabled = true | ||
bind-address = ":8090" | ||
database = "udp2" | ||
""" | ||
|
||
|
||
import argparse | ||
|
||
from influxdb import InfluxDBClient | ||
|
||
|
||
def main(uport): | ||
"""Instantiate connection to the InfluxDB.""" | ||
# NOTE: structure of the UDP packet is different than that of information | ||
# sent via HTTP | ||
json_body = { | ||
"tags": { | ||
"host": "server01", | ||
"region": "us-west" | ||
}, | ||
"time": "2009-11-10T23:00:00Z", | ||
"points": [{ | ||
"measurement": "cpu_load_short", | ||
"fields": { | ||
"value": 0.64 | ||
} | ||
}, | ||
{ | ||
"measurement": "cpu_load_short", | ||
"fields": { | ||
"value": 0.67 | ||
} | ||
}] | ||
} | ||
|
||
# make `use_udp` True and add `udp_port` number from `influxdb.conf` file | ||
# no need to mention the database name since it is already configured | ||
client = InfluxDBClient(use_udp=True, udp_port=uport) | ||
|
||
# Instead of `write_points` use `send_packet` | ||
client.send_packet(json_body) | ||
|
||
|
||
def parse_args(): | ||
"""Parse the args.""" | ||
parser = argparse.ArgumentParser( | ||
description='example code to play with InfluxDB along with UDP Port') | ||
parser.add_argument('--uport', type=int, required=True, | ||
help=' UDP port of InfluxDB') | ||
return parser.parse_args() | ||
|
||
|
||
if __name__ == '__main__': | ||
args = parse_args() | ||
main(uport=args.uport) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,4 @@ | |
] | ||
|
||
|
||
__version__ = '5.2.0' | ||
__version__ = '5.2.2' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got an error when all fields contain NaN values. I changed this to
for ts, tag, rec in dataframe_zip if any(rec)
to skip the points with all empty fields.