Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SaQC
Manage
Activity
Members
Labels
Plan
Issues
36
Issue boards
Milestones
Wiki
Code
Merge requests
8
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rdm-software
SaQC
Commits
000010c5
Commit
000010c5
authored
5 years ago
by
David Schäfer
Browse files
Options
Downloads
Patches
Plain Diff
pandas does not preserve the dict key order when creating from a list of dicts
parent
0cd1b2d1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/common.py
+12
-1
12 additions, 1 deletion
test/common.py
with
12 additions
and
1 deletion
test/common.py
+
12
−
1
View file @
000010c5
...
@@ -9,6 +9,7 @@ import pandas as pd
...
@@ -9,6 +9,7 @@ import pandas as pd
from
saqc.core.core
import
prepareMeta
,
readMeta
from
saqc.core.core
import
prepareMeta
,
readMeta
from
saqc.flagger
import
SimpleFlagger
,
DmpFlagger
from
saqc.flagger
import
SimpleFlagger
,
DmpFlagger
from
saqc.core.config
import
Fields
as
F
TESTNODATA
=
(
np
.
nan
,
-
9999
)
TESTNODATA
=
(
np
.
nan
,
-
9999
)
...
@@ -37,8 +38,18 @@ def initMetaString(metastring, data):
...
@@ -37,8 +38,18 @@ def initMetaString(metastring, data):
return
fobj
,
meta
return
fobj
,
meta
def
_getKeys
(
metadict
):
keys
=
list
(
metadict
[
0
].
keys
())
for
row
in
metadict
[
1
:]:
for
k
in
row
.
keys
():
if
k
not
in
keys
:
keys
.
append
(
k
)
return
keys
def
initMetaDict
(
metadict
,
data
):
def
initMetaDict
(
metadict
,
data
):
meta
=
prepareMeta
(
pd
.
DataFrame
(
metadict
),
data
)
df
=
pd
.
DataFrame
(
metadict
)[
_getKeys
(
metadict
)]
meta
=
prepareMeta
(
df
,
data
)
fobj
=
io
.
StringIO
()
fobj
=
io
.
StringIO
()
meta
.
to_csv
(
fobj
,
index
=
False
)
meta
.
to_csv
(
fobj
,
index
=
False
)
fobj
.
seek
(
0
)
fobj
.
seek
(
0
)
...
...
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