I am not able use datacompy on python 2.7. There was one method written by my seniors compare.consolidate_exel_report method which znt recgnzd n py3 - python-2.7

I am not able use datacompy on python 2.7. There was one method written by my seniors compare.consolidate_exel_report method which is not being recognised in python3. I was trying to run same in python2 but now i can't use datacompy there
Is there any replace for thatethod in python3 or how can I use datacompy now on python2.7.5

Related

Can't find pvlib.pvsystem.Array

I am using pvlib-python to model a series of photovoltaic installations.
I have been running the normal pvlib-python procedural code just fine (as described in the intro tutorial.
I am now trying to extend my model to be able to cope with several arrays of panels in different directions etc, but connected to the same inverter. For this I though the easiest way would be to use pvlib.pvsystem.Array to create a list of Array-objects that I can then pass to the pvlib.pvsytem.PVSystem class (as described here).
My issue now is that I can't find pvsystem.Array at all? eg I'm just getting:
AttributeError: module 'pvlib.pvsystem' has no attribute 'Array'
when I try to create an instance of Array using:
from pvlib import pvsystem
module_parameters = {'pdc0': 5000, 'gamma_pdc': -0.004}
array_one = pvsystem.Array(module_parameters=module_parameters)
array_two = pvsystem.Array(module_parameters=module_parameters)
system_two_arrays = pvsystem.PVSystem(arrays=[array_one, array_two],
inverter_parameters=inverter_parameters)
as described in the examples in the PVSystem and Arrays page.
I am using pvlib-python=0.8.1, installed in my conda env using conda install -c conda-forge pvlib-python.
I am quite confused about this since I can obviously see all the documentation on pvsystem.Array on read-the-docs and see the source code on pvlib's github.
When I look at the code in my conda env it doesn't have Array under pvsystem (or if I list it using dir(pvlib.pvsystem)), so it is something wrong with the installation, but I simply can't figure out what. I've tried installing pvlib again and using different installation but always the same issue.
Am I missing something really obvious here?
Kind regards and thank you,
This feature is not present in the current stable version (8.1). If you want to use it already you could download the latest source as a zip file and install it, or clone the pvlib git repository on your computer.

How to make python accept strings as unicode in python2.7

I wrote a web scraping code in python 3.6 and the text part is Unicode in it. my boss asked me to use python 2.7 instead for existing codebase compatibility.
I changed basic things like formatted print and division etc... I am getting the same output for python 2.7 also, but if I see the string processing
it's showing in this way with Unicode prefix
u'10. Can a customer get a welcome kit containing ATM card, chequebook, and internet password at the time of opening the account?'
just to be in the safe side for future issues I want to make python
2.7 treat strings as python 3.6, is it possible?

Enthought Canopy User Input

I'm using Enthought Canopy on Mac OSX Lion. I'm using this because of the ease at which modules and libraries can be downloaded and installed (had a lot of trouble downloading pandas and numpy through terminal due to a number of issues).
So, now I'm doing my coding for a project in Canopy, which is OK (still prefer Wing, though). The problem I have encountered is that I need to ask the user for input. When I do, for instance:
x = input('Enter your input here: ')
I get an EOF error as follows: EOFError: EOF when reading a line
I was looking around and believe that this may be something which Canopy does not support. Was wondering if this is, indeed, the case and if there is a solution/workaround to this problem?
I assume that you are entering this code in the IPython shell that is embedded in the Canopy editor. This is an upstream bug/deficiency in IPython's Qt console. Because the remote shell is not actually hooked up to a terminal, functions like input() and raw_input() need to be replaced to get the input from the GUI console widget instead. IPython (and thus Canopy) does replace raw_input() but does not replace input(). This code will work using Canopy's Python interpreter if you were to put it into a script and execute it from the command line, and it would also work in a terminal instance of IPython. It was most likely overlooked because it is usually considered a bad idea to use input().
Please use raw_input() instead and parse the string that you get. You can use eval() if you must, but I do recommend using a more specific parsing/conversion function.

Embedding IPython-shell in C/C++-program

I have a C++-program that allows me to run Python-scripts that C++ passes data to. If the Python-script fails the C++-program calls PyRun_InteractiveLoop to allow investigating the problem on an interactive shell. This works alright but I thought "Would be cool if IPython is installed I could use it in that case".
Now my problem is: all I find when looking for "ipython embedding" is instructions how to embed IPython into Python-programs (amongst others http://ipython.org/ipython-doc/dev/interactive/reference.html#embedding-ipython). I tried to reproduce these on the embedded regular python-shell I have but most of them fail in some way (usually because of a missing sys.argv .... that one I can solve).
Any suggestions how to do this? My first plan would have been to first import IPython via the C-API (that one I got covered). If that fails use the "regular" shell. Otherwise call IPython.embed() (or similar) via PyRun_InteractiveOneFlags
Have you considered using python debugger
>>> import pdb
>>> import yourmodule
>>> pdb.run('yourmodule.test()')

how to get value from spinctrl and send it to .exe file in python script

I am new to python and wxpython, I am making a automated tool using python and for user interface wxpython and i use shell script.shell script can be called from the python. but now I am facing problem with the spinctrl value. whenever that spinctrl value changes it have to send that value into one txt.exe file which is written in BASH .{ if we run txt.exe file in command line it will ask for number then it will accept that value whenever we press enter}. but i am not able to understand that how to send value from spinctrl to txt.exe whenever i press "ok" button in GUI. please share your thoughts and knowledge.
Thank you
To call an executable in Python, you need to look at Python's subprocess module: http://docs.python.org/2/library/subprocess.html
If your exe doesn't accept arguments, then it won't work. If you created the exe yourself using something like PyInstaller or py2Exe, then you need to make it so your app can accept arguments. The simplest way is using sys.argv, but there are also the optparse and argparse libraries in Python as well.
I do not get a good feeling about your concept. It is hard to say, but I suspect you would benefit from talking with someone experienced about what you are trying to achieve and how it could best be done.
However, to get you started down your current path, I think you should take a look at wxExecute ( http://docs.wxwidgets.org/2.8/wx_processfunctions.html#wxexecute ). This will allow you to run your txt.exe utility from inside your GUI.
wxExecute is a wxWidgets utility. If you are working in python then there will be a more direct way to do this using a python utility - some-one else will have to advise on that. I suggest you edit your question for clarity so a python expert can help you.