Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
datascout
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ABP Computing
ABP Computing Sandbox
datascout
Commits
77065231
Commit
77065231
authored
11 months ago
by
[ACC] Elena Operation
Browse files
Options
Downloads
Patches
Plain Diff
fixing minor bug
parent
6bd60506
No related branches found
No related tags found
No related merge requests found
Pipeline
#7382096
failed
11 months ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
datascout/_datascout.py
+13
-9
13 additions, 9 deletions
datascout/_datascout.py
with
13 additions
and
9 deletions
datascout/_datascout.py
+
13
−
9
View file @
77065231
...
@@ -20,8 +20,6 @@ from pathlib import Path
...
@@ -20,8 +20,6 @@ from pathlib import Path
######
######
# Functions needed to split 2D arrays
# Functions needed to split 2D arrays
"""
"""
def
_split_2D_array
(
val
,
in_memory
=
False
,
split_to_list
=
False
,
verbose
=
False
):
def
_split_2D_array
(
val
,
in_memory
=
False
,
split_to_list
=
False
,
verbose
=
False
):
"""
It converts numpy 2D arrays into either 1D arrays or list of 1D arrays
"""
It converts numpy 2D arrays into either 1D arrays or list of 1D arrays
...
@@ -43,13 +41,19 @@ def _split_2D_array(val, in_memory=False, split_to_list=False, verbose=False):
...
@@ -43,13 +41,19 @@ def _split_2D_array(val, in_memory=False, split_to_list=False, verbose=False):
newVal
=
list
(
val
)
newVal
=
list
(
val
)
else
:
else
:
# (TODO: probably to be done better!!!)
# (TODO: probably to be done better!!!)
auxDim
=
np
.
shape
(
val
)[
0
]
auxDim0
=
np
.
shape
(
val
)[
0
]
# split val, without making data copy
newVal
=
''
auxData
=
np
.
split
(
np
.
ravel
(
val
),
auxDim
)
if
auxDim0
==
0
:
# put it in object array
if
verbose
:
newVal
=
np
.
empty
((
auxDim
,),
dtype
=
object
)
print
(
'
detected empty 2D array
'
)
for
i
in
range
(
auxDim
):
newVal
=
np
.
empty
(
np
.
shape
(
val
),
dtype
=
object
)
newVal
[
i
]
=
auxData
[
i
]
else
:
# split val, without making data copy
auxData
=
np
.
split
(
np
.
ravel
(
val
),
auxDim0
)
# put it in object array
newVal
=
np
.
empty
((
auxDim0
,),
dtype
=
object
)
for
i
in
range
(
auxDim0
):
newVal
[
i
]
=
auxData
[
i
]
if
verbose
:
if
verbose
:
print
(
"
-----
"
)
print
(
"
-----
"
)
print
(
str
(
val
)
+
"
(
"
+
str
(
type
(
val
))
+
"
)
"
)
print
(
str
(
val
)
+
"
(
"
+
str
(
type
(
val
))
+
"
)
"
)
...
...
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