Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nibio_graph_sem_seg
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maciej Wielgosz
nibio_graph_sem_seg
Commits
7c9656f8
Commit
7c9656f8
authored
1 year ago
by
Maciej Wielgosz
Browse files
Options
Downloads
Patches
Plain Diff
show parameters of a point cloud in txt format
parent
6b3b3e44
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
utils/cloud_txt_param.py
+34
-0
34 additions, 0 deletions
utils/cloud_txt_param.py
with
34 additions
and
0 deletions
utils/cloud_txt_param.py
0 → 100644
+
34
−
0
View file @
7c9656f8
import
pandas
as
pd
import
argparse
# Define the command-line arguments
parser
=
argparse
.
ArgumentParser
(
description
=
'
Read a CSV file into a pandas DataFrame and find the max values.
'
)
parser
.
add_argument
(
'
file_path
'
,
help
=
'
The path to the CSV file
'
)
# Parse the command-line arguments
args
=
parser
.
parse_args
()
# Read the CSV file into a pandas DataFrame
df
=
pd
.
read_csv
(
args
.
file_path
)
# print the max value for each column
print
(
'
Max value for each column:
'
)
print
(
df
.
max
())
# print the min value for each column
print
(
'
Min value for each column:
'
)
print
(
df
.
min
())
# find the box dimensions only for x, y, and z
print
(
'
Box dimensions:
'
)
print
(
df
[[
'
x
'
,
'
y
'
,
'
z
'
]].
max
()
-
df
[[
'
x
'
,
'
y
'
,
'
z
'
]].
min
())
# compute a middle point for the box
print
(
'
Middle point:
'
)
print
(
df
[[
'
x
'
,
'
y
'
,
'
z
'
]].
mean
())
# round the x, y, and z values to two decimal places and save the contents to a new CSV file
df
[[
'
x
'
,
'
y
'
,
'
z
'
]]
=
df
[[
'
x
'
,
'
y
'
,
'
z
'
]].
round
(
2
)
df
.
to_csv
(
'
rounded.csv
'
,
index
=
False
)
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