I have a csv file with few rows and columns of data. Now I intend to extrapolate or interpolate new data if the input values are not matching in the csv.
Let me describe my csv as follows.
type,depth,io,mux,enr
perf,1024,32,4,103.8175
perf,1024,64,4,85.643125
perf,1024,128,4,76.5559375
perf,1024,256,4,72.01246094
dense,1024,32,4,107.391875
dense,1024,64,4,88.99640625
dense,1024,128,4,79.79851563
dense,1024,256,4,75.19976563
If the input does not match with the depth or io value present in the csv. I would like to generate the output after extrapolation/interpolation.
For that I need to build an array from the column.
Is there anyway to store one of the columns from this csv or storing the csv as a list and from there?
I tried the following.
import os
import pandas as pd
this_dir, this_filename = os.path.split(__file__)
memory_file_path = os.path.join(this_dir, 'memory.csv')
memData = pd.read_csv(memory_file_path, delimiter= ',',)
class InvecasMem:
def csvImport(self,depth,io):
csvmem = memData.loc[(memData["type"] == "perf")
& (memData['depth'] == depth)
& (memData['io'] == io)]
if len(csvmem) == 0:
print("Error: Wrong configuration")
memArr = memData.loc[(memData["type"] == "perf")]
l = [list(row) for row in memArr.values]
x=len(l)
return l
However, I am unable to store the column into an array?
Also, is it possible to produce extrapolated values from multiple inputs as in this case?
Thanks in advance.
Edit: The desired output as in io = [32,64,128,256,32,64,128,256] Whereas I am going to compute for depth = 512 and io = 256