Replacing csv sequence decimal and seperator signs throuout code and examples

decimal sign now point, seperator now comma
This commit is contained in:
2023-02-11 21:30:36 +01:00
parent 25513cc7c5
commit c5a9c2649b
7 changed files with 70 additions and 70 deletions
+3 -3
View File
@@ -112,13 +112,13 @@ class ExecCSVThread(Thread):
def read_csv_to_array(filepath): # convert a given csv file to a numpy array
# csv format: time (s); xField (T); yField (T); zField (T) (german excel)
# csv format: time [s], xField [T], yField [T], zField [T] (german excel)
# decimal or period commas. Do not use these characters as a thousands seperator!
with open(filepath, 'r') as csv_file:
# Normalize seperators
csv_string = csv_file.read().replace(',', '.')
csv_string = csv_file.read()
# read csv file without column headers
file = pandas.read_csv(StringIO(csv_string), sep=';', decimal='.', header=0)
file = pandas.read_csv(StringIO(csv_string), sep=',', decimal='.', header=0)
array = file.to_numpy() # convert csv to array
return array