ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Pandas install on ERPnext VM

bug
frappe

#1

Greetings,

I am trying to setup pandas on the ERPnextVM in order to use it in a basic data analysis script.

I tried installing it normally pip install pandas it raised conflicting errors, i tried adding it in a new app and running bench setup requirements but it doesnt seem to install it.

The error log is:

numpy.f2py.f2py2e: module references file
numpy.f2py.setup: module references file
numpy.lib.utils: module references file
numpy.lib.utils: module references path
numpy.lib.utils: module MAY be using inspect.getsource
numpy.lib.utils: module MAY be using inspect.getsourcefile
numpy.testing.nose_tools.noseclasses: module references file
numpy.testing.nose_tools.nosetester: module references file
numpy.testing.nose_tools.parameterized: module MAY be using inspect.stack
numpy.testing.nose_tools.utils: module references file
creating /usr/local/lib/python2.7/dist-packages/numpy-1.14.1-py2.7-linux-i686.egg
Extracting numpy-1.14.1-py2.7-linux-i686.egg to /usr/local/lib/python2.7/dist-packages
Adding numpy 1.14.1 to easy-install.pth file
Installing f2py script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/numpy-1.14.1-py2.7-linux-i686.egg
Searching for pytz>=2011k
Reading https://pypi.python.org/simple/pytz/
Downloading https://pypi.python.org/packages/bf/d1/d0c9babd1695441cb059be39f9eea38ad1b631cd386765d2cdc97359ccae/pytz-2018.3-py2.7.egg#md5=c5b4a9db14a291d3b38a4fa8d3192b5e
Best match: pytz 2018.3
Processing pytz-2018.3-py2.7.egg
Moving pytz-2018.3-py2.7.egg to /usr/local/lib/python2.7/dist-packages
Adding pytz 2018.3 to easy-install.pth file

Installed /usr/local/lib/python2.7/dist-packages/pytz-2018.3-py2.7.egg
Finished processing dependencies for pandas

Any help is welcome.

Kr,

Oasis


#2

The solution was

sudo easy_install pandas, it worked after many failures.

Thanks


#3

Looking out for a pandas experienced person on ERPNext for stock pivots by warehouse, item group, brand, etc.


#4

Yup pivot tables are the way to analyse data, plot and isolate trends, or troubleshoot missing data.

This ‘sales funnel’ tutorial has lots of q&a comments https://pbpython.com/pandas-pivot-table-explained.html

This OReilly one https://jakevdp.github.io/PythonDataScienceHandbook/03.09-pivot-tables.html uses a Titanic passenger dataset for multivariable pivot table sex, age, class, fare, and second birthrate data example.

The first tutorial uses just the command line while the second one uses the Jupyter notebook code workspace. Both environments require some ‘terminal console’ skill.

The question is, to what degree anyone has mashed pandas into ERPNEXT or limited to manual command line intervention cases?


#5

I am trying to use pandas on a script report so the challenges I see are:

  1. How to prepare data from frappe.db.sql to be able to present as raw_data into pandas.
  2. How to convert data from pandas.crosstab into a format that can be used as data return back to the grid from the report.

issue 1. Currently the frappe.db.sql outputs dictionary of row values where as pandas expects in a dictionary of column values.
issue 2. Currently the pandas.crosstab outputs in a dataframe format native to pandas and visible on console, but the data to be returned from the script is a row list of column list.

Not sure if my analysis is correct, but that’s what it looks like.

If anybody has managed to make a script report with pandas, an example will be appreciated.