FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
docker-python/tests/test_datashader.py at master · inwaves/docker-python · GitHub
inwaves
/
docker-python
Public
forked from
Kaggle/docker-python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
docker-python
/
tests
/
test_datashader.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
38 lines (31 loc) · 1.4 KB
Breadcrumbs
docker-python
/
tests
/
test_datashader.py
Copy path
File metadata and controls
38 lines (31 loc) · 1.4 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import
unittest
import
numpy
as
np
import
pandas
as
pd
import
datashader
as
ds
import
datashader
.
transfer_functions
as
tf
class
TestDatashader
(
unittest
.
TestCase
):
# based on https://github.com/pyviz/datashader/blob/master/datashader/tests/test_pipeline.py
def
test_pipeline
(
self
):
df
=
pd
.
DataFrame
({
'x'
:
np
.
array
(([
0.
]
*
10
+
[
1
]
*
10
)),
'y'
:
np
.
array
(([
0.
]
*
5
+
[
1
]
*
5
+
[
0
]
*
5
+
[
1
]
*
5
)),
'f64'
:
np
.
arange
(
20
,
dtype
=
'f8'
)
})
df
.
f64
.
iloc
[
2
]
=
np
.
nan
cvs
=
ds
.
Canvas
(
plot_width
=
2
,
plot_height
=
2
,
x_range
=
(
0
,
1
),
y_range
=
(
0
,
1
))
pipeline
=
ds
.
Pipeline
(
df
,
ds
.
Point
(
'x'
,
'y'
))
img
=
pipeline
((
0
,
1
), (
0
,
1
),
2
,
2
)
agg
=
cvs
.
points
(
df
,
'x'
,
'y'
,
ds
.
count
())
self
.
assertTrue
(
img
.
equals
(
tf
.
shade
(
agg
)))
color_fn
=
lambda
agg
:
tf
.
shade
(
agg
,
'pink'
,
'red'
)
pipeline
.
color_fn
=
color_fn
img
=
pipeline
((
0
,
1
), (
0
,
1
),
2
,
2
)
self
.
assertTrue
(
img
.
equals
(
color_fn
(
agg
)))
transform_fn
=
lambda
agg
:
agg
+
1
pipeline
.
transform_fn
=
transform_fn
img
=
pipeline
((
0
,
1
), (
0
,
1
),
2
,
2
)
self
.
assertTrue
(
img
.
equals
(
color_fn
(
transform_fn
(
agg
))))
pipeline
=
ds
.
Pipeline
(
df
,
ds
.
Point
(
'x'
,
'y'
),
ds
.
sum
(
'f64'
))
img
=
pipeline
((
0
,
1
), (
0
,
1
),
2
,
2
)
agg
=
cvs
.
points
(
df
,
'x'
,
'y'
,
ds
.
sum
(
'f64'
))
self
.
assertTrue
(
img
.
equals
(
tf
.
shade
(
agg
)))
Back
|
FazBrowse Home
|
New Git URL