You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importnumpyasnpfromscipy.sparseimportcsr_matriximportscipyasspimportpandasaspddf=pd.read_csv('01-averageDailyFlights.csv', header=0, index_col=0) # Adjust the path and options as neededdense_matrix=df.values# Step 3: Convert the dense matrix to a sparse matrixsparse_matrix=csr_matrix(dense_matrix,)
sp.sparse.save_npz('test.npz', sparse_matrix)
The text was updated successfully, but these errors were encountered:
...since @dodedic's CSV files are currently ~40MB in size, you might want to look into:
scipy.sparse.save_npz
The text was updated successfully, but these errors were encountered: