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
7ba46d49
Commit
7ba46d49
authored
4 years ago
by
Bert Palm
🎇
Browse files
Options
Downloads
Patches
Plain Diff
min, max, to_csv, isnull, notnull
parent
5f9f19aa
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dios/dios.py
+41
-5
41 additions, 5 deletions
dios/dios.py
with
41 additions
and
5 deletions
dios/dios.py
+
41
−
5
View file @
7ba46d49
...
...
@@ -191,16 +191,19 @@ class DictOfSeries(_DiosBase):
b
int64
dtype
:
object
"""
if
isinstance
(
attr_or_callable
,
str
):
attr_or_callable
=
getattr
(
pd
.
Series
,
attr_or_callable
)
call
=
callable
(
attr_or_callable
)
attrOcall
=
attr_or_callable
if
isinstance
(
attrOcall
,
str
):
attrOcall
=
getattr
(
pd
.
Series
,
attrOcall
)
call
=
callable
(
attrOcall
)
if
not
call
:
attrOcall
=
attr_or_callable
data
=
pd
.
Series
(
dtype
=
'
O
'
,
index
=
self
.
columns
)
for
c
in
self
.
columns
:
dat
=
self
.
_data
.
at
[
c
]
if
call
:
data
.
at
[
c
]
=
attr
_or_callable
(
dat
,
**
kwds
)
data
.
at
[
c
]
=
attr
Ocall
(
dat
,
**
kwds
)
else
:
data
.
at
[
c
]
=
attr
_or_callable
.
fget
(
dat
)
data
.
at
[
c
]
=
get
attr
(
dat
,
attrOcall
)
return
data
def
apply
(
self
,
func
,
axis
=
0
,
raw
=
False
,
args
=
(),
**
kwds
):
...
...
@@ -394,6 +397,28 @@ class DictOfSeries(_DiosBase):
def
debugDf
(
self
):
return
self
.
to_df
()
def
min
(
self
,
axis
=
0
,
skipna
=
True
):
if
axis
in
[
0
,
'
index
'
,
None
]:
return
self
.
for_each
(
pd
.
Series
.
min
,
skipna
=
skipna
)
elif
axis
in
[
1
,
'
columns
'
]:
func
=
lambda
s1
,
s2
:
s1
.
where
(
s1
<
s2
,
s2
)
res
=
self
.
_reduce_horizontal
(
func
,
np
.
inf
)
if
not
skipna
:
res
.
loc
[
self
.
isna
().
any
(
axis
=
1
)]
=
np
.
nan
return
res
raise
ValueError
(
axis
)
def
max
(
self
,
axis
=
None
,
skipna
=
None
):
if
axis
in
[
0
,
'
index
'
,
None
]:
return
self
.
for_each
(
pd
.
Series
.
min
,
skipna
=
skipna
)
elif
axis
in
[
1
,
'
columns
'
]:
func
=
lambda
s1
,
s2
:
s1
.
where
(
s1
>
s2
,
s2
)
res
=
self
.
_reduce_horizontal
(
func
,
-
np
.
inf
)
if
not
skipna
:
res
.
loc
[
self
.
isna
().
any
(
axis
=
1
)]
=
np
.
nan
return
res
raise
ValueError
(
axis
)
# ----------------------------------------------------------------------
# Boolean stuff
...
...
@@ -432,10 +457,16 @@ class DictOfSeries(_DiosBase):
data
=
self
.
for_each
(
'
isna
'
)
return
DictOfSeries
(
data
=
data
,
itype
=
self
.
itype
,
cast_policy
=
self
.
_policy
,
fastpath
=
True
)
def
isnull
(
self
):
return
self
.
isna
()
def
notna
(
self
):
data
=
self
.
for_each
(
'
notna
'
)
return
DictOfSeries
(
data
=
data
,
itype
=
self
.
itype
,
cast_policy
=
self
.
_policy
,
fastpath
=
True
)
def
notnull
(
self
):
return
self
.
notna
()
# ----------------------------------------------------------------------
# Rendering Methods
...
...
@@ -502,6 +533,11 @@ class DictOfSeries(_DiosBase):
return
pprint_dios
(
self
,
**
kwargs
)
def
to_csv
(
self
,
*
args
,
**
kwargs
):
self
.
to_df
().
to_csv
(
*
args
,
**
kwargs
)
to_csv
.
__doc__
=
pd
.
DataFrame
.
to_csv
.
__doc__
def
_empty_repr
(
di
):
return
f
"
Empty DictOfSeries
\n
"
\
...
...
This diff is collapsed.
Click to expand it.
Bert Palm
🎇
@palmb
mentioned in issue
#23
·
4 years ago
mentioned in issue
#23
mentioned in issue #23
Toggle commit list
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