FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib/examples/misc/rec_join_demo.py at master · dpsanders/matplotlib · GitHub
dpsanders
matplotlib
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib
/
examples
/
misc
/
rec_join_demo.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (25 loc) · 818 Bytes
Breadcrumbs
matplotlib
/
examples
/
misc
/
rec_join_demo.py
Copy path
File metadata and controls
31 lines (25 loc) · 818 Bytes
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
from
__future__
import
print_function
import
numpy
as
np
import
matplotlib
.
mlab
as
mlab
import
matplotlib
.
cbook
as
cbook
datafile
=
cbook
.
get_sample_data
(
'aapl.csv'
,
asfileobj
=
False
)
print
(
'loading'
,
datafile
)
r
=
mlab
.
csv2rec
(
datafile
)
r
.
sort
()
r1
=
r
[
-
10
:]
# Create a new array
r2
=
np
.
empty
(
12
,
dtype
=
[(
'date'
,
'|O4'
), (
'high'
,
np
.
float
),
(
'marker'
,
np
.
float
)])
r2
=
r2
.
view
(
np
.
recarray
)
r2
.
date
=
r
.
date
[
-
17
:
-
5
]
r2
.
high
=
r
.
high
[
-
17
:
-
5
]
r2
.
marker
=
np
.
arange
(
12
)
print
(
"r1:"
)
print
(
mlab
.
rec2txt
(
r1
))
print
(
"r2:"
)
print
(
mlab
.
rec2txt
(
r2
))
defaults
=
{
'marker'
:
-
1
,
'close'
:
np
.
NaN
,
'low'
:
-
4444.
}
for
s
in
(
'inner'
,
'outer'
,
'leftouter'
):
rec
=
mlab
.
rec_join
([
'date'
,
'high'
],
r1
,
r2
,
jointype
=
s
,
defaults
=
defaults
)
print
(
"
\n
%sjoin :
\n
%s"
%
(
s
,
mlab
.
rec2txt
(
rec
)))
Back
|
FazBrowse Home
|
New Git URL