Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何将dataframe列更改为字符串_Python_String_Pandas_Dataframe - Fatal编程技术网

Python 如何将dataframe列更改为字符串

Python 如何将dataframe列更改为字符串,python,string,pandas,dataframe,Python,String,Pandas,Dataframe,firs3是一个数据帧,已经对它进行了处理,现在我想返回STNAME列作为一个只包含STNAME的字符串列表,我该怎么做 print(first3.loc['STNAME']) first3.STNAME.astype(str).value?first3['STNAME'].tolist()?或者对于loc,您需要为所有行添加::first3.loc[:,'STNAME'].tolist()

firs3是一个数据帧,已经对它进行了处理,现在我想返回STNAME列作为一个只包含STNAME的字符串列表,我该怎么做

print(first3.loc['STNAME'])
first3.STNAME.astype(str).value
first3['STNAME'].tolist()
?或者对于loc,您需要为所有行添加
:first3.loc[:,'STNAME'].tolist()