Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试从 pdf 中提取表格数据并将它们存储为数据框。但是表格数据的格式不正确。
下面是我得到的数据框:
但我希望该数据框采用以下格式。
请帮助我如何编写通用代码才能做到这一点。
重命名您的列:
df.columns = ['Colour', 'Size', 'Base Size', 'Value', 'Base Amount', 'Absolute', 'Approx']
并删除前两行:
df.drop([0, 1], inplace=True)