Forum Discussion
Anonymous
6 years agoNot applicable
Power query python dataset from an other table
Hello, I have a table called "mytab" contaning a column "Expression" like this : I am writing a python script (a regex function) in "mytab2" which need to import "expression" from "m...
ImkeF
6 years agoCommunity Champion
Hi Anonymous ,
the python-script will sit in a Python.Execute function in PQ. It will be escaped in there. In order to integrate some objects from the M-world, you have to unescapce the script and combine with ampersand "&":
Python.Execute ( "import pandas as pd
myListOfExpression = pd.DataFrame( " & mytab & "dataset['Expression'],columns=['Expression1'],dtype=float)
This syntax is probably wrong, as "mytab" returns the whole table, but this is the general principle on how to combine M-objects with python scripts.
mytab[Expression] would return a list with the column contents BTW.