Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
afzalphatan
Resolver I
Resolver I

Export power query table into R or Python

Hi Experts, 

 

@Greg_Deckler

 

@Zubair_Muhammad

 

Is there an option that I do all the data cleaning in Power query and then import that table into R or Python ?? Please let me know

 

Regards

Afzal khan

1 REPLY 1
vyacheslavg
Helper II
Helper II

I checked - everything works.

For example, you can input file from Python, apply Power query and then pass it back to Python.

I'm not sure about any usefulness of such workflow, but it works.

 

let
    Source = Python.Execute("import pandas as pd#(lf)df1 = pd.read_parquet(r'C:\Users\MyPC\Dropbox\Documents\DataScience\Pandas\pandas\chicago.parquet')"),
    df2 = Source{[Name="df1"]}[Value],
    #"Changed Type" = Table.TransformColumnTypes(df2,{{"Employee Annual Salary", type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type","$","",Replacer.ReplaceText,{"Employee Annual Salary"}),
    #"Filtered Rows" = Table.SelectRows(#"Replaced Value", each [Employee Annual Salary] <> null and [Employee Annual Salary] <> ""),
    #"Run Python script" = Python.Execute("# 'dataset' holds the input data for this script#(lf)dataset.to_parquet(r'C:\Users\MyPC\Dropbox\Documents\DataScience\Pandas\pandas\pbd.parquet')#(lf)",[dataset=#"Filtered Rows"])
in
    #"Run Python script"

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors