I have this code:
path = "C:\\Files"
dir = os.listdir(path)
diccio = {}
list = []
MValores = np.array([])
for i in dir:
file = np.genfromtxt(os.path.join(path, i), delimiter=",")
precioCierre = file[:, 0]
list.append(precioCierre)
nombre = i[1:7]
diccio[nombre] = precioCierre
MValores = np.column_stack(list)
data = pd.DataFrame(diccio)
I have a list of ".csv" files.
-EURHKD_H1.csv
-EURJPY_H1.csv
-EURNZD_H1.csv
-EURTRY_H1.csv
-EURUSD_H1.csv
And i use this code to create a DataFrame. With this df i do this:
data = np.corrcoef(data, rowvar=0)
A = minimum_spanning_tree(data)
print(A)
print(type(data))
the problem is when i get the minimun spanning tree i get a numpy type
<class 'numpy.ndarray'>
and i wanna get a DataFrame type. With the same code i use with numpy i wanna convert that code to pandas code to create a DataFrame.