Skip to content
Snippets Groups Projects
Commit 4a3d9c64 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

LogParser: conversion of values from string to float

parent 303225c3
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,15 @@ except ImportError:
raise ImportError("Please make sure that the python3-pandas package is installed.")
def try_numeric(value):
try:
return int(value)
except ValueError:
try:
return float(value)
except ValueError:
return value
class TableColumn:
def __init__(self, level, data, parentPath=None):
self.subcolumns = []
......@@ -165,9 +174,9 @@ class LogParser:
col_val = {}
for k, v in row.items():
if len(k) == 1 and k[0] in index_names:
idx_itms[k[0]] = v
idx_itms[k[0]] = try_numeric(v)
else:
col_val[k] = v
col_val[k] = try_numeric(v)
# construct the index tuple
idx = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment