I have a data logging result.
I want to add / append names in the top of them in other words row wise i want to add names in 1st row of an array.
Like
Timestamp Accleration(x) Accleration(y) Accleration(z) Gyro(x) Gyro(y)
125252 ............ 12 ............ 10 ........ ...... 08 ................. 32 ............. 12
ANY HELP
timestamped_imu_readings = np.ndarray((0,), np.float32)
#creating and assigning an array to store readings
timestamp= time.time()*1000
#millisecond timestamping
timestamped_imu_readings = np.append(timestamped_imu_readings, lsm6ds33.get_accelerometer_g_forces())
timestamped_imu_readings = np.append(timestamped_imu_readings, lsm6ds33.get_accelerometer_angles())
timestamped_imu_readings = np.append(timestamped_imu_readings, lsm6ds33.get_gyroscope_raw())
timestamped_imu_readings = np.append(timestamped_imu_readings, lis3mdl.get_magnetometer_raw())
#appending IMU readings to the array
timestamped_imu_readings = np.append(float(timestamp),timestamped_imu_readings)
#adding sensor readings in a row
with open("IMU_Readings_muh.csv", "ab") as f:
np.savetxt(f, np.expand_dims(timestamped_imu_readings, axis=0), fmt="%4.8f" , delimiter=",")
savetxttakes a header parameter.savetxtis just a bunch of formattedf.write. If you don't like what it writes, write your own. There's no compiled magic.