[Python][Web Apps] Use Python pandas in a web job RRS feed

  • Question

  • Hi all,

    I'm trying to use the pandas package in a web job. I included the zipped pandas source code in my zip file uploaded to the web job. In my Python script, I added 

    sys.path.insert(0, '')

    This is how I used the Azure SDK for Python in a web job, but it's not working for pandas. I guess it depends on how the package was written, but I don't know how to compile a pandas package that can be used in a web job.

    Any idea?

    Thank you! 

    Thursday, December 3, 2015 10:19 PM


  • As the WebJob created by python scripts, will run in Azure Web App default python runtime, which is located at D:\Python27 or D:\Python34. And we don’t have the permission to complete the python env with the full dependencies to enable to run package pandas.

    As in my test, I tried several ways to manage to run pandas code, but only can be successful when I leverage virtual environment of python on Azure Web App, I can make it work.

    So you can try in this way:

    1, create a virtual env of python on local, and deploy it on your application directory on Azure Web App, you can refer to for more information.

    2, you can directly upload the dependencies of pandas to the library of python virtual env on Azure, which may similar with “D:\home\site\wwwroot\env\Lib\site-packages>” (assume the virtual env's name is "env"). Of cause, you can install the packages when you creating a new virtual env at step 1.

    3, leverage sys.path.append() to include the package path, here is the test code:

    import sys
    sitepackage = "D:\home\site\wwwroot\env\Lib\site-packages"
    import pandas as pd
    import numpy as np
    s = pd.Series([1,3,5,np.nan,6,8])
    print s

    Friday, December 4, 2015 7:53 AM