[英]I want to print the value between 2 to 5 from 1first columns
df['output'] = df.colA.apply(lambda x: x[1:6])
should work.应该管用。 Docs for apply function: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.apply.html申请 function 的文档: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.apply.html
df5['output']=df5['colA'].str[1:6]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.