Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 33,Jogging,49105962326000,-0.6946377,12.680544,0.50395286;
- 33,Jogging,49106062271000,5.012288,11.264028,0.95342433;
- 33,Jogging,49106112167000,4.903325,10.882658,-0.08172209;
- 33,Jogging,49106222305000,-0.61291564,18.496431,3.0237172;
- 33,Jogging,49106332290000,-1.1849703,12.108489,7.205164;
- 33,Jogging,49106442306000,1.3756552,-2.4925237,-6.510526;
- import numpy as np
- file = open("WISDM_ar_v1.1_raw.txt", "r")
- list_arr = file.readlines()
- length = len(list_arr)
- list1 = []
- #print(length)
- for i in range(length):
- list_arr[i] = list_arr[i].rstrip("n")
- list_arr[i] = list_arr[i].rstrip(";")
- list_arr[i] = list_arr[i].split(",")
- if len(list_arr[i]) == 6:
- list1.append(list_arr[i])
- else:
- pass
- array1 = np.array(list1,dtype=str)
- print(array1.dtype)
- array2 = np.delete(array1, [0,1], axis=1)
- print(array2.dtype)
- array2 = array2.astype(np.float)
- print(array2)
- <U15
- <U15
- Traceback (most recent call last):
- File "D:/Anaconda/network/.idea/testfloat.py", line 22, in <module>
- array2 = array2.astype(np.float)
- ValueError: could not convert string to float:
Add Comment
Please, Sign In to add comment