eg1:
My csv data like this below,i wt count list nums
2018上,"['C', 'B', 'B', 'B', 'D', 'A', 'B', 'C', 'A', 'D', 'B', 'D', 'A', 'A', 'A', 'C', 'D', 'B', 'C', 'B', 'A', 'C', 'A', 'D', 'A', 'D', 'B', 'D', 'B', 'C', 'B', 'A', 'D', 'B', 'C', 'B、C', 'B', 'B', 'B', 'D', 'B', 'C', 'C', 'B', 'B', 'D', 'A', 'D', 'D', 'C', 'B', 'B', 'A', 'B', 'C', 'B', 'B', 'B', 'A', 'A', 'A', 'C', 'A', 'B', 'A', 'A、A', 'B、C', 'C', 'D', 'B', 'C', 'C', 'A']" eg: df_data = np.array(pd.read_csv(answer_file, header=None))
new_data = []
for d in df_data:
y = d[]
ya = d[] # '[\\'C\\',\\'A\\']'
#(1)check one
y2 = np.array(ya) # ['C','A'] #this is what i not want
y2_test = y2.shape # 0-d
y2_test2 = y2.tolist() # dtype shows not list #the right methon
#(2)check one
ls = ya.strip('][').split(',') # dtype show list
#(3) right methon
import ast
ls = ast.iteral_eval(ya)
ls = [i.strip() for i in ls]