Skip to content
Snippets Groups Projects
Commit 7c9656f8 authored by Maciej Wielgosz's avatar Maciej Wielgosz
Browse files

show parameters of a point cloud in txt format

parent 6b3b3e44
No related branches found
No related tags found
No related merge requests found
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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment