I have 2 csv files with 16 columns and 146 rows. I am trying to do the following (This is not actual data):
a = [1, 2, 3, 4, 5, 6]
b = [10, 20, 30, 40, 50, 60]
final output of the script intended:
x = [ 11, 22, 33, 22, 22.5, 33] # basically the last half of the array needs to be divided by 2
I have tried out the follwoing code:
import csv
import numpy as np
import sys
data = np.genfromtxt('./test1.csv', dtype=float, delimiter=',')
data_sys = np.genfromtxt('.test2.csv', dtype=float, delimiter=',')
z = np.add (data, data_sys)
np.savetxt("new_before_avg.csv", z, delimiter= ',')
z[:,8:15] = z[:,8:15]/2
np.savetxt("new_after_avg.csv"], z, delimiter= ",")
Problem is, I am seeing the final output as expected except for the last column (column 15). It is just added up, did not divide by 2.
I thought my indexing was right. Please help.