Creating a Qlikview mapping within Python

26 views Asked by At

I am fairly new to Python and was trying to migrate a Qlikview process over so that it can run in Python.

The first step of this would be to set up all the mappings that Qlikview is using.

It is acquiring the mappings from an Excel file that is read in an each mapping is detailed on separate sheets.

I am looking at doing this by importing the mappings to store as dictionaries (if there's a better way please let me know).

With some of the mappings, certain columns need to be concatenated to become one column. Below is how I've gotten it working. Although because there are a lot of mappings I was wondering if there was an easier way to get them set up correctly in the dictionaries as having to repeat this for multiple mappings would be time consuming.

import pandas as pd

d = pd.read_excel(r"filepath\filename.xlsx", sheet_name=5)

d['NEWCOL'] = d['COL1'] + '-' + d['COL2']

d = d.drop(columns=['COL1', 'COL2'])

col = d.pop('COL3')
d.insert(1, col.name, col)
0

There are 0 answers