Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pony
tshistory
Commits
5096a16c5d40
Commit
8c500838
authored
Jul 11, 2019
by
Aurélien Campéas
Browse files
testutils: expose a `hist_to_df` utility
Convenient to have an history as a dataframe.
parent
12ec9d4f570b
Changes
1
Hide whitespace changes
Inline
Side-by-side
tshistory/testutil.py
View file @
5096a16c
...
...
@@ -22,13 +22,17 @@ def assert_df(expected, df):
assert
exp
==
got
def
assert_hist
(
expected
,
dfdict
):
def
hist_to_df
(
dfdict
):
# copy to avoid side effects
series
=
[(
key
,
serie
.
copy
())
for
key
,
serie
in
dfdict
.
items
()]
for
revdate
,
serie
in
series
:
inject_in_index
(
serie
,
revdate
)
series
=
pd
.
concat
([
serie
for
_
,
serie
in
series
])
return
pd
.
concat
([
serie
for
_
,
serie
in
series
])
def
assert_hist
(
expected
,
dfdict
):
series
=
hist_to_df
(
dfdict
)
assert_df
(
expected
,
series
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment