abilian / olapy

OlaPy, an experimental OLAP engine based on Pandas
GNU Lesser General Public License v2.1
106 stars 21 forks source link

cube_loader_custom bug : 'list' object has no attribute 'keys' #40

Open alanzhanglei opened 2 years ago

alanzhanglei commented 2 years ago

Traceback (most recent call last): File "D:\programs\anaconda3\envs\py39tst\lib\site-packages\olapy\core\mdx\executor\cube_loader_custom.py", line 51, in load_tables df = df[list(dimension["columns"].keys())] AttributeError: 'list' object has no attribute 'keys'

dimensions = [{'name': 'mems', 'displayName': 'mems', 'columns': [{'name': 'mem_id'}, {'name': 'age'}, {'name': 'name', 'column_new_name': 'full_name'}]

should update

   df = df[list(dimension["columns"].keys())]

to

   df[[col['name'] for col in dimension["columns"]]]