Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/336.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
如何删除Dataframe、Python中不必要的字符串_Python_Pandas_String_Dataframe_Remove - Fatal编程技术网

如何删除Dataframe、Python中不必要的字符串

如何删除Dataframe、Python中不必要的字符串,python,pandas,string,dataframe,remove,Python,Pandas,String,Dataframe,Remove,我想删除第0列[原始审查]和第1列[评级值] 如果列名是字符串,我尝试了df.str.replace('ratingValue','') 0 1 [Original review: July 18, 2020] [ratingValue, 5] 如果列名是整数 df['0'] = df['0'].str.replace('Original review: ', '') df['1'] = df['1'].str.r

我想删除第0列[原始审查]和第1列[评级值]


如果列名是字符串,我尝试了
df.str.replace('ratingValue','')

0                                   1
[Original review: July 18, 2020]    [ratingValue, 5]
如果列名是整数

df['0'] = df['0'].str.replace('Original review: ', '')   
df['1'] = df['1'].str.replace('ratingValue, ', '')

@吉米,你能提供更多关于你的数据帧的信息吗?什么是列-
0
1
原始评论
评级值
?这是否回答了您的问题?
df[0] = df[0].str.replace('Original review: ', '')
df[1] = df[1].str.replace('ratingValue, ', '')