I need to extract the specified characters in the specified column in the csv file,I got an error saying "TypeError: tuple indices must be integers or slices, not str"
my csv file
name,age,sex
li,26,M
mu,30,F
import os
import pandas as pd
import glob
for i in glob.glob('H:\\1\\*.csv'):
result_1=pd.read_csv(i,encoding="utf-8",dtype=object)
SubNetwork_list=list(result_1.groupby(["name"]))
for SubNetwork in SubNetwork_list:
SubNetwork_pd=pd.DataFrame(SubNetwork["li"])
SubNetwork_pd.to_csv("H:\\2\\li.csv",encoding="utf-8",
header=True,index=False,mode='a')
console error
SubNetwork_pd=pd.DataFrame(SubNetwork['li'])
TypeError: tuple indices must be integers or slices, not str