-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OccResponse in occurrences #171
Comments
Hey, thanks for raising this. For users ease execute() method throws a pandas dataframe and sets the data in the 'data' attribute. so you can use object.data to access it later on. The to_pandas method also exists on the OccResponse object and not a DF - so the error popped up. |
on another note, you should ideally create an object using occurrences.search() and do an execute() using object.execute(). This will allow you to play around with the data, do necessary transformations without having to refetch if you do some modifications (fetched result is also stored in as object.data). Everytime you call .search() - it creates a new object, and you might end up frequently refetching data. |
Hi @Ei3-kw , Thank you for opening the issue. Can you provide some full code with comments indicating what you are trying to do? |
I am calling from pyobis import occurrences
# search up OBIS JP node
df = occurrences.search(nodeid='0d07a0ea-9c75-48e8-b3fd-c28d653f4270', size=69)
fetched = df.execute() # fetch the db
print(f"Columns in the fetched Dataframe: {fetched.columns}")
df.to_pandas() But fetched data, which's stored as The columns of fetched data
I've got around it by using the fetched data straight away and calling Cheers, Ella |
Thanks for the code snippet. I was able to reproduce this. Sorry for the issue. We probably thought people would be directly using the |
Hi,
It seems to me that
execute()
inOccResponse
gives out the results data straight away instead of{'total': int, 'results': dict}
, which voids theto_pandas()
function.This is inconsistent with provided documentation as well as other classes.
Also is there a way to get all the
nodeid
sCheers, Ella
The text was updated successfully, but these errors were encountered: