使用df_dict2 = pd.read_fwf(io.stringio(read_data),delim_whitespace = true)时问题

发布于 2025-02-12 19:27:36 字数 359 浏览 0 评论 0原文

问题:从字符串加载数据框时,称为read_data如下:

导入pandas为pd 导入IO read_data =“”“操作应用描述


说明详细信息名称 关联 Statm工作在居住状态 统计 Bytes 0字节总数大小 滴入0的学生数量 兰斯 lanst"""

df = pd.read_fwf(io.StringIO(read_data), delim_whitespace=True)

the output as shown in the attached image. The main issue for words "stats" and "lans" the last s got removed when the df创建

Issue: when loading data frame from string CALLED read_data as follow:

import pandas as pd
import io
read_data = """ operational applied description


description Details names
link
statm working The state of the residenat
stats
in-bytes 0 Bytes Total number size
in-drops 0 Number of student drop
lans
lanst"""

df = pd.read_fwf(io.StringIO(read_data), delim_whitespace=True)

the output as shown in the attached image. The main issue for words "stats" and "lans" the last s got removed when the df created

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文