From c8afb2d8e8e277d9661df927d0bd5b00fab8eaa1 Mon Sep 17 00:00:00 2001 From: Leif Warland Date: Fri, 4 Nov 2022 14:34:06 +0100 Subject: [PATCH] Do not include index in uuid --- rawxio/rawx.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rawxio/rawx.py b/rawxio/rawx.py index 8c0e093..ef2af8c 100644 --- a/rawxio/rawx.py +++ b/rawxio/rawx.py @@ -53,6 +53,8 @@ def read_rawx(fname: Path) -> Dict[str, pd.DataFrame]: result = {} for key, d in data["network"].items(): data = d["data"] + if not data: + continue if get_rawx_record_type(data) == DataSetType.PARAMETER_SET: data = [data] df = pd.DataFrame(data, columns=d["fields"]) @@ -65,7 +67,7 @@ def read_rawx(fname: Path) -> Dict[str, pd.DataFrame]: # The frame has primary keys. We produce a hash value to use for index based # on the primary keys pk_fields = list(set(get_pk_fields(key)).intersection(df.columns)) - index = [uuid(t) for t in df[sorted(pk_fields)].itertuples()] + index = [uuid(t) for t in df[sorted(pk_fields)].itertuples(name=None, index=False)] df = df.set_index(pd.Index(index, name="uid")) result[key] = df return result