Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SAMPLE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OTHgroup
SAMPLE
Commits
2277b703
Commit
2277b703
authored
9 months ago
by
Wachter, Christoph
Browse files
Options
Downloads
Patches
Plain Diff
(CW) pandas related bugfix for some read and write functionality
parent
93974afb
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
sample/helpers/ReadWrite.py
+5
-2
5 additions, 2 deletions
sample/helpers/ReadWrite.py
with
5 additions
and
2 deletions
sample/helpers/ReadWrite.py
+
5
−
2
View file @
2277b703
...
@@ -317,7 +317,8 @@ def writeConfigurationsAndPropertiesToFile(
...
@@ -317,7 +317,8 @@ def writeConfigurationsAndPropertiesToFile(
# When tuples are converted to string, whitespaces are automatically inserted between elements
# When tuples are converted to string, whitespaces are automatically inserted between elements
# -> remove them before writing
# -> remove them before writing
df
[
CONFIGS_KEY
]
=
df
[
CONFIGS_KEY
].
map
(
str
).
str
.
replace
(
'
'
,
''
)
# CW <15.10.2024> commented line as tuples do not need to be converted to string anymore
#df[CONFIGS_KEY] = df[CONFIGS_KEY].map(str).str.replace(' ', '')
df
.
to_csv
(
filename
,
df
.
to_csv
(
filename
,
sep
=
delimiter
,
sep
=
delimiter
,
...
@@ -364,7 +365,9 @@ def readConfigurationsAndPropertiesFromFile(filename, delimiter=';', get_comment
...
@@ -364,7 +365,9 @@ def readConfigurationsAndPropertiesFromFile(filename, delimiter=';', get_comment
# this conversion from strings to tuples takes most of the time
# this conversion from strings to tuples takes most of the time
# but it's hard to optimize since the tuple has no fixed length
# but it's hard to optimize since the tuple has no fixed length
configs_set
=
df
[
headers
[
0
]].
apply
(
get_tuple_from_string
,
convert_dtype
=
tuple
).
tolist
()
# CW <15.10.2024> removed "convert_dtype" to be compatible with future pandas versions
# try updating pandas if you're having issues
configs_set
=
df
[
headers
[
0
]].
apply
(
get_tuple_from_string
).
to_list
()
# get properties if they exist
# get properties if they exist
property_set
=
None
property_set
=
None
...
...
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