Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
esap-userprofile-python-client
Manage
Activity
Members
Labels
Plan
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ASTRON SDC
ESCAPE WP5
esap-userprofile-python-client
Commits
bba861ec
Commit
bba861ec
authored
4 years ago
by
Hugh Dickinson
Browse files
Options
Downloads
Patches
Plain Diff
Optional conversion to dataframe
parent
02e3722a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
zooniverse/zooniverse.py
+26
-20
26 additions, 20 deletions
zooniverse/zooniverse.py
with
26 additions
and
20 deletions
zooniverse/zooniverse.py
+
26
−
20
View file @
bba861ec
...
...
@@ -34,7 +34,7 @@ class zooniverse:
except
PanoptesAPIException
as
e
:
return
False
def
generate
(
self
,
item
,
wait
=
False
,
**
read_csv_args
):
def
generate
(
self
,
item
,
wait
=
False
,
convertToFrame
=
True
,
**
read_csv_args
):
print
(
"
Generating requested export...
"
)
if
wait
:
print
(
"
\t\t
Waiting for generation to complete...
"
)
...
...
@@ -44,6 +44,7 @@ class zooniverse:
self
.
_get_item_entry
(
item
,
"
category
"
),
generate
=
True
,
wait
=
wait
)
if
response
.
ok
:
if
convertToFrame
:
return
(
pd
.
read_csv
(
io
.
BytesIO
(
response
.
content
),
...
...
@@ -54,10 +55,12 @@ class zooniverse:
if
wait
else
response
)
else
:
return
response
else
:
return
None
def
retrieve
(
self
,
item
,
generate
=
False
,
wait
=
False
,
**
read_csv_args
):
def
retrieve
(
self
,
item
,
generate
=
False
,
wait
=
False
,
convertToFrame
=
True
,
**
read_csv_args
):
if
self
.
is_available
(
item
)
and
not
generate
:
response
=
self
.
_get_entity
(
item
).
get_export
(
self
.
_get_item_entry
(
item
,
"
category
"
),
generate
=
False
,
wait
=
wait
...
...
@@ -78,16 +81,19 @@ class zooniverse:
self
.
_get_item_entry
(
item
,
"
category
"
),
generate
=
True
,
wait
=
wait
)
if
response
.
ok
:
if
convertToFrame
:
return
(
pd
.
read_csv
(
io
.
BytesIO
(
response
.
content
),
converters
=
zooniverse
.
category_converters
[
self
.
_get_item_entry
(
item
,
"
category
"
)
],
**
read_csv_args
],
)
if
wait
else
response
)
else
:
return
response
else
:
return
None
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment