Open LauraNovoa opened 9 years ago
I downloaded the new version Resolution to energistream-py issue #15... that you posted and installed it :
But again, when I try to use get_energy command for sensor 610
data = stream.get_energy(610, start = '05/19/2015', end = '05/20/2015', tz = 'local').head(2)
print(data)
it still shows me the error:
Traceback (most recent call last):
File "C:\Users\ldn\Desktop\EnergiStream Python Laura\energistreamAPITest2.py", line 20, in <module>
data = stream.get_energy(610, start = '05/19/2015', end = '05/20/2015', tz = 'local').head(2)
File "build\bdist.win32\egg\energistream\stream.py", line 265, in get_energy
start, end = _sanitize_dates(start, end, tz=tz)
File "build\bdist.win32\egg\energistream\stream.py", line 647, in _sanitize_dates
if tz:
File "C:\Python27\lib\site-packages\pandas\core\generic.py", line 714, in __nonzero__
.format(self.__class__.__name__))
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
I'm sure I am doing something wrong here.... could you please help?
1) From your local energistream-py directory make sure you are on the master branch :
$ git checkout master $ git pull origin
2) Verify that the merge has been completed successfully :
$ git log
Look for the following commit ID : commit d27c10ff946fbb93e713072db8a876b8e2d53f57
3) Run a pip install for the current directory. As we are operating on unix we are unable to verify the installation process in windows.
4) Please terminate and restart your ipython session from the terminal.
At this point you should have our updated changes, hopefully our command will work at this point.
When you run energistream-py and instantiate the stream you would previously have done so with a command such as :
energiscore.EnergiStreamClient(‘USER’,'PASS')
Replace this with :
energiscore.EnergiStreamClient(‘USER’,’PASS’, include_sensors=True)
Reply :
1) should I input the command line in the Python Shell or on the Windows cmd window? I tried both and it didn’t work (screenshots below)…. I tried different combinations of the command, like not inputting the ‘$’ ... I am sorry this is probably something very obvious that I just don’t have any background of...
Inline image 2 2) Same as 1) : where do I input this command?
3) When you say: run a pip install you mean just entering the command line ‘pip install’ ?
4) When you say restart your ipython session from the terminal, again should I use the Python Shell or Windows cmd window? What are the commands lines to do so?
Lastly, on the full command I am running I just notice I already have the ‘include_sensors = True’ Here is copy of it all: *NOTE: I didn't write that. It was one of our former grad students.
import csv import pandas as pd import energistream as es # Imports the Energiscore Library import datetime as dt # Imports the datetime Library for timeseries handling import numpy as np # Imports the Numpy Library for series handling
pd.set_option('display.height', 100000) pd.set_option('display.max_rows', 50000) pd.set_option('display.max_columns', 500000) pd.set_option('display.width', 100000) import energistream as es stream = es.EnergiStreamClient(‘USER’, ‘pass', include_sensors=True)
data = stream.get_energy(610, start = '05/19/2015', end = '05/20/2015', tz = 'local').head(2) print(data)
Again I apologize for asking such basic things. I really appreciate all the help thus far. I really appreciate the level of detail on your step by step! Unfortunately I could not even get pass the first step... Here are my questions:
1) should I input the command line in the Python Shell or on the Windows cmd window? I tried both and it didn’t work (screenshots below)…. I tried different combinations of the command, like not inputting the ‘$’ ... I am sorry this is probably something very obvious that I just don’t have any background of... Inline image 1
Inline image 2 2) Same as 1) : where do I input this command?
3) When you say: run a pip install you mean just entering the command line ‘pip install’ ?
4) When you say restart your ipython session from the terminal, again should I use the Python Shell or Windows cmd window? What are the commands lines to do so?
Lastly, on the full command I am running I just notice I already have the ‘include_sensors = True’ Here is copy of it all: *NOTE: I didn't write that. It was one of our former grad students.
import csv import pandas as pd import energistream as es # Imports the Energiscore Library import datetime as dt # Imports the datetime Library for timeseries handling import numpy as np # Imports the Numpy Library for series handling
pd.set_option('display.height', 100000) pd.set_option('display.max_rows', 50000) pd.set_option('display.max_columns', 500000) pd.set_option('display.width', 100000) import energistream as es stream = es.EnergiStreamClient(‘USER’, ‘pass', include_sensors=True)
data = stream.get_energy(610, start = '05/19/2015', end = '05/20/2015', tz = 'local').head(2) print(data)
Again I apologize for asking such basic things. I really appreciate all the help thus far.
Laura, could you describe how you originally copied the energistream-py repository?
Harry, I downloaded the ZIP of the repo and I unzipped it on my C: drive. I manually downloaded the requisites: pandas, requests, and testfixtures and I followed the online procedures to install them. After I had pip installed I could run the commands on my windows cmd:
cd C:\energistream-py-master\energistream
pip install stream
To make sure I went to C:\energistream-py-master and clicked on setup.py ....
Also, I typed on my windows cmd
pip install stream --upgrade
And I got the following:
Thank you, Laura.
At this time the shortest path to get running again would be to completely delete your local energistream-py repository, re-download the energistream-py repository which we have updated on GitHub, and reinstall using the procedure you described above.
Here is the zip URL :
https://github.com/Melrok/energistream-py/archive/master.zip
From the command line navigate into the new unzipped energistream-py repo and run :
$ sudo pip install -e .
You should only need to do this for energistream-py, the rest of the dependencies should be fine as is.
You should then be able to execute your shell commands as you were doing previously. Just remember when instantiating the stream client inside of the shell to replace the line :
energiscore.EnergiStreamClient(‘USER’,'PASS')
With :
energiscore.EnergiStreamClient(‘USER’,’PASS’, include_sensors=True)
For future reference the repository 'stream' is not related to our product and its name is coincidental. Our product is currently not available from the python package library. I am sorry for any confusion this similarity may have caused you.
Hello Melrok staff:
For some reason, I seem not to be able to get values from some meters/sensors that I want, in other words, I am using the get_energy command, because I want Reactive Power and Power Factor as well, so I go ahead and do the stream.sensors command: The sensors I am interested in are the ones below:
But when I try to run my code for, lets say sensor 610:
I get the following error in my Python Shell:
It seems weird because When I use a 4-digit (or more) sensor number, like 8812 or 9000000151, it works and I get the data:
I really appreciate any help you might be able to give me in the matter.