From acaf88a1b9c3b389289e54d086eec084d24e9792 Mon Sep 17 00:00:00 2001 From: mdeegen <84499883+mdeegen@users.noreply.github.com> Date: Wed, 28 Feb 2024 13:07:05 +0100 Subject: [PATCH] Update pandas_utils.py for coloumn names with line breaks --- paderbox/utils/pandas_utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/paderbox/utils/pandas_utils.py b/paderbox/utils/pandas_utils.py index 82790503..7660b861 100644 --- a/paderbox/utils/pandas_utils.py +++ b/paderbox/utils/pandas_utils.py @@ -102,9 +102,11 @@ def py_query( assert use_pd_query is False, use_pd_query keywords = ['index'] + list(data) - - def is_valid_variable_name(name): + + def is_valid_variable_name(name: str): import ast + if len(name.splitlines()) != 1: + return False # https://stackoverflow.com/a/36331242/5766934 try: ast.parse('{} = None'.format(name))