Forum Discussion

mhaupt's avatar
mhaupt
Copper Contributor
Feb 26, 2024

Python Polars behaving strangely in Azure Function

Hi there,

First time poster, hope I am asking the right forum.

I noticed something weird when using Python Polars in Azure Functions, wondering if anyone could shed some light on what's happening.

I use a Polars' query/dataframe to do some ETL, then convert it to a Pandas' dataframe so I can do some manipulation that requires recursion that Polars can't easily handle.

The issue I found was converting from Polars to Pandas.  The command:

 
self.DataFrame==DverseTableQuery.collect().to_pandas()

 

where self.Dataframe is Pandas and DverseTableQuery is Polars works fine in Visual Studio.  When I publish it in Azure Function it refuses to run.  And as I believe there is no easy way to debug Python code in Azure Function, I don't know why.

To add to my confusion, the following works fine in Azure Ops:

DataFrameConversionDict=DverseTableQuery.collect().to_dict() self.DataFrame=pd.DataFrame(DataFrameConversionDict)

 

Could anyone able to advise please:

1. what is the reason for the strange behaviour in Azure Function?

2.  Is there a way I can connect Visual Studio as a remote debugger of Azure Function Python, like I understand you can with C++?

1 Reply

  • mhaupt's avatar
    mhaupt
    Copper Contributor

    mhaupt 

     

    Correction to my first formula (single =):

    self.DataFrame=DverseTableQuery.collect().to_pandas()

Resources