I am trying to write a python function that returns only one dataframe in power bi. I have multiple data frames in my python script but I only want one dataframe to be returned or printed in my power bi environment.
This is my trial, but for some reason, it is not returning anything while trying to connect.
import pandas as pd
import numpy as np
def my_func():
df=[["d","t","u","y","e"],["d",np.nan,np.nan,np.nan,"o"],["y","p","p","w","r"]]
df1=[["d","t","u","y","e"],["d",np.nan,np.nan,np.nan,"o"],["y","p","p","w","r"]]
df=pd.DataFrame(df)
df1=pd.DataFrame(df1)
return df
my_func()
I was expecting this script to return
df
but it is not returning anything. Is there anything I am missing? Can anyone help me please? What am I missing and why it is not working?
However, this works fine when i dont use function.
I am just wondering why this is not working when I use function and return.