Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dios
Manage
Activity
Members
Labels
Plan
Issues
11
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
0
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
dios
Commits
16dbb699
Commit
16dbb699
authored
5 years ago
by
Bert Palm
🎇
Browse files
Options
Downloads
Patches
Plain Diff
fixed bool-dios indexing align bug
parent
6d8a0cdc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dios/dios.py
+2
-3
2 additions, 3 deletions
dios/dios.py
dios/locator.py
+16
-6
16 additions, 6 deletions
dios/locator.py
with
18 additions
and
9 deletions
dios/dios.py
+
2
−
3
View file @
16dbb699
...
...
@@ -243,10 +243,9 @@ class DictOfSeries:
def
_setitem_dios
(
self
,
data
,
value
):
keys
=
self
.
columns
.
intersection
(
data
.
columns
)
for
k
in
keys
:
l
=
self
.
_data
.
at
[
k
]
r
=
value
[
k
]
idx
=
l
.
index
.
intersection
(
r
.
index
)
l
[
idx
]
=
r
[
idx
]
idx
=
data
.
_data
.
at
[
k
]
.
index
.
intersection
(
r
.
index
)
self
.
_data
.
at
[
k
]
[
idx
]
=
r
[
idx
]
@property
def
loc
(
self
):
...
...
This diff is collapsed.
Click to expand it.
dios/locator.py
+
16
−
6
View file @
16dbb699
...
...
@@ -55,7 +55,8 @@ class _LocIndexer(_Indexer):
data
=
self
.
_data
.
loc
[
colkey
].
copy
()
# .loc[any, scalar]
# .loc[any, scalar] -> (a single) series
# .loc[scalar, scalar] -> (a single) value
if
_is_hashable
(
colkey
):
new
=
data
.
loc
[
rowkey
]
...
...
@@ -63,8 +64,12 @@ class _LocIndexer(_Indexer):
else
:
for
k
in
data
.
index
:
data
.
at
[
k
]
=
data
.
at
[
k
].
loc
[
rowkey
]
# .loc[scalar, non-scalar] -> column-indexed series
if
_is_hashable
(
rowkey
):
new
=
data
# .loc[non-scalar, non-scalar] -> dios
else
:
new
=
self
.
_dios
.
copy_empty
(
columns
=
False
)
new
.
_data
=
data
...
...
@@ -106,16 +111,21 @@ class _iLocIndexer(_Indexer):
data
=
self
.
_data
.
iloc
[
colkey
].
copy
()
# .iloc[any, scalar]
# .iloc[any, int] -> single series
# .iloc[int, int] -> single value
if
_is_integer
(
colkey
):
new
=
data
.
iloc
[
rowkey
]
# .iloc[any, non-
scalar
]
# .iloc[any, non-
int
]
else
:
for
k
in
data
.
index
:
data
.
at
[
k
]
=
data
.
at
[
k
].
iloc
[
rowkey
]
# .iloc[int, non-int] -> column-indexed series
if
_is_integer
(
rowkey
):
new
=
data
# .iloc[non-int, non-int] -> dios
else
:
new
=
self
.
_dios
.
copy_empty
(
columns
=
False
)
new
.
_data
=
data
...
...
@@ -127,11 +137,11 @@ class _iLocIndexer(_Indexer):
if
_is_dios_like
(
rowkey
)
or
_is_dios_like
(
colkey
):
raise
ValueError
(
"
Cannot index with multidimensional key
"
)
# .iloc[any,
scalar
]
# .iloc[any,
int
]
if
_is_integer
(
colkey
):
self
.
_data
.
iat
[
colkey
].
iloc
[
rowkey
]
=
value
# .iloc[any, non-
scalar
]
# .iloc[any, non-
int
]
else
:
for
s
in
self
.
_data
.
iloc
[
colkey
]:
s
.
iloc
[
rowkey
]
=
value
...
...
@@ -211,7 +221,7 @@ class _aLocIndexer(_Indexer):
for
i
,
c
in
enumerate
(
colkeys
):
l
=
self
.
_data
.
at
[
c
]
r
=
value
[
c
]
idx
=
l
.
index
.
intersection
(
r
.
index
)
idx
=
l
.
loc
[
rowkeys
[
i
]].
index
.
intersection
(
r
.
index
)
l
[
idx
]
=
r
[
idx
]
# row align - align given series to every series in ourself
...
...
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