Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
Read_from_Kairos_Component
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dasharatha.vamshi
Read_from_Kairos_Component
Commits
0e60af8c
Commit
0e60af8c
authored
Feb 15, 2021
by
Akshay G
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handling empty dataframe
parent
451dceb8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
main.py
main.py
+9
-2
No files found.
main.py
View file @
0e60af8c
...
...
@@ -84,7 +84,14 @@ def get_data(query):
[
KariosConstants
.
VALUES_KEY
]
df
=
DataFrame
.
from_dict
(
data
)
logger
.
debug
(
"Dataframe --> {}"
.
format
(
df
.
head
()))
df
.
columns
=
[
KariosConstants
.
TIMESTAMP_COLUMN_NAME
,
list
(
config
[
KariosConstants
.
TAG_HIERARCHY_KEY
]
.
keys
())[
0
]]
if
len
(
df
)
>
0
:
df
.
columns
=
[
KariosConstants
.
TIMESTAMP_COLUMN_NAME
,
list
(
config
[
KariosConstants
.
TAG_HIERARCHY_KEY
]
.
keys
())
[
0
]]
else
:
logger
.
warn
(
"The dataframe is empty!"
)
df
=
DataFrame
(
columns
=
[
KariosConstants
.
TIMESTAMP_COLUMN_NAME
,
list
(
config
[
KariosConstants
.
TAG_HIERARCHY_KEY
]
.
keys
())[
0
]])
return
df
else
:
raise
Exception
(
response
.
json
()[
KariosConstants
.
ERRORS_KEY
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment