forked from zietzm/Helmholtz_Test_Bench
Replacing csv sequence decimal and seperator signs throuout code and examples
decimal sign now point, seperator now comma
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user