Advertisement
mhdew

dataset fixing

Oct 14th, 2020 (edited)
755
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. import pandas as pd
  2. from sklearn.model_selection import train_test_split
  3.  
  4. # reading featuers of dataset
  5. f=open('/content/spike_counts.txt', 'r')
  6.  
  7. lst0=[]
  8. for i in f:
  9.     lst1=[int(j) for j in i.split(' ')]
  10.     lst0.append(lst1)
  11.  
  12. df0=pd.DataFrame(lst0)
  13. print(df0.shape)
  14.  
  15. #reading labels of dataset
  16. df1=pd.read_table('/content/location_areas.txt',header=None)
  17. print(df1.shape)
  18.  
  19. #splitting the dataset into 80%-20% train-test segments
  20. X_train,X_test,y_train,y_test=train_test_split(df0,df1,train_size=0.8,random_state=0)
  21. print(X_train.shape)
  22. print(X_test.shape)
  23. print(y_train.shape)
  24. print(y_test.shape)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement