fork download
  1. import os
  2. import glob
  3. import pandas as pd
  4. import numpy as np
  5. from sklearn.svm import SVC
  6.  
  7. path = "/home/me/Desktop/pca-comma-seperated-csv" #path to my pca'd files
  8. all_files = glob.glob(os.path.join(path, "*.csv"))
  9. df_from_each_file = (pd.read_csv(f) for f in all_files) #creating dataframe from 90 csv files,each csv file containing 2 columns and upto 23000 columns
  10. X = pd.concat(df_from_each_file, ignore_index=True)
  11. classfile = "/home/me/Desktop/1.csv" #path to my label file
  12. Y = pd.read_csv(classfile, header=1)
  13. X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42)
  14. clf = SVC()
  15. clf.fit(X_train, y_train)
  16. y_pred = clf.predict(x_test)
  17. confusion_matrix(y_test, y_pred)
  18. # your code goes here
Runtime error #stdin #stdout #stderr 0s 23352KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 3, in <module>
ImportError: No module named pandas