我有一个保存字符串的 pandas 系列。但是,当我希望将该系列转换为字符串时,每个单元格仅限于多个字符。有谁知道我是否做错了什么或者是否有解决方法。data = np.array(['good day good sir how are you doing today? I sure hope you are well', 'e', 'e', 'k','s'])
ser = pd.Series(data)
ser.to_string()电流输出:0 good day good sir how are you doing today? I s...\n1 e\n2 e\n3 k\n4 s'想要的输出:'0 good day good sir how are you doing today? I sure hope you are well\n1 e\n2 e\n3 k\n4 s'有什么办法可以得到完整的字符串吗?
3 回答

泛舟湖上清波郎朗
TA贡献1818条经验 获得超3个赞
Series.to_string()返回系列的字符串表示形式,而不是减少的值,如果要将所有字符串组合在一个字符串中,请替换 ser.to_string()
for " ".join(ser)
,它将用空格连接所有字符串。

慕村225694
TA贡献1880条经验 获得超4个赞
driver.close()它关闭是因为您在末尾添加了内容。只要删除该行,浏览器就会永远保持打开状态。如果你想在一段时间后关闭它,那么你可以像这样添加time.sleep之前:driver.close()
import time
# Your code
time.sleep(60) #Stays open for 60 seconds (which is 1 min)
driver.close()
- 3 回答
- 0 关注
- 183 浏览
添加回答
举报
0/150
提交
取消