import sys
file_path = "path_to_your_csv"
stream_in = open(file_path, 'rb')
A = [];
B = [];
for line in stream_in.readlines():
add_to_List = line.split(",")[1].strip()
if 'A' in line:
A.append(add_to_List);
if 'B' in line:
B.append(add_to_List)
stream_in.close()
print A
print B
将数据放入pandas系列object names ser之后,只需输入
ser.loc("A")
和ser.loc("B")
以获取所需的数据片。你知道吗为向量使用预先指定的名称会导致大量重复的逻辑,如果在数据描述中添加新的向量,这会变得越来越复杂。。。你知道吗
最好使用字典
相关文件,来自the python official documentation
相关问题 更多 >
编程相关推荐