The first column is dates and the following columns are nodes (6100). When I read the csv, the values are in one column(Added a picture). So, I did the separate by space and added the headers. Each node has 4 values corresponding to one date, but the data gets filled under dates.
What it does:
Date 1 2 3 4 ...
2/12 14 14 14 14
14 13 13 13 nan
14 13 13 13 nan
14 13 13 13 nan
What I am trying to get
Date 1 2 3 4 ...
2/12 14 14 14 14
14 13 13 13
14 13 13 13
14 13 13 13
2/13 ......
I am very stuck on this. Any suggestions would help. Thanks in advance :)
path =r'Paco' # use your path
#filenames = glob.glob(path + "/*_drh.csv")
filenames = glob.glob(path + "/FM2Sim_GW_HeadAllOut.txt")
filename ={}
for filename in filenames:
if len(filenames) == 1:
#The setup
column_name = np.arange(0,6101).tolist()
daa = pd.read_csv(filename,comment='C',header = None,sep = '\s+', names = column_name, parse_dates=[0],low_memory=False,index_col=False)
daa = daa.iloc[6:]
daa = daa.rename(columns = {"0":"Dates"})
