Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.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
Python 3.x 处理从PDF中提取的混乱csv数据的最佳方法是什么_Python 3.x_Csv_Pdf_Tabula - Fatal编程技术网

Python 3.x 处理从PDF中提取的混乱csv数据的最佳方法是什么

Python 3.x 处理从PDF中提取的混乱csv数据的最佳方法是什么,python-3.x,csv,pdf,tabula,Python 3.x,Csv,Pdf,Tabula,我已将此csv文件加载到列表中。作为 dataFromFile = list(csv.reader(f)) 每个值都应该是一个列表元素,我以后可以很容易地对其进行操作。但正如您所看到的,有些值合并为1。喜欢有些人完全错过了那个位置,就像。 现在我通过硬拷贝、移动、合并、删除每一行来完成所有操作。我想知道是否有一个好的和方便的工具来帮助我做这项工作? 所有数据都来自表格。剩下的几页看起来很方便,但这一页坏了 All 0 ['', 'Mar 2017', 'Dec 2016', 'Sept 201

我已将此csv文件加载到列表中。作为

dataFromFile = list(csv.reader(f))
每个值都应该是一个列表元素,我以后可以很容易地对其进行操作。但正如您所看到的,有些值合并为1。喜欢有些人完全错过了那个位置,就像。 现在我通过硬拷贝、移动、合并、删除每一行来完成所有操作。我想知道是否有一个好的和方便的工具来帮助我做这项工作? 所有数据都来自表格。剩下的几页看起来很方便,但这一页坏了

All
0 ['', 'Mar 2017', 'Dec 2016', 'Sept 2016', 'Jun 2016', 'Mar 2016']
1 ['Earnings growth*', '6.9%', '5.6% (2.1%)', '7.2%', '11.1%', '-0.3%']
2 ['', '12.7%', '', '', '']
3 ['Capital spending', '4.1% Median = 7.5% 3.2% (6.8%)', '5.5%', '6.1%', '']
4 ['Advertising and', '', '', '', '']
5 ['marketing spending', '', '', '', '']
6 ['', '2.0% 1.9% (1.7%)', '2.2%', '6.1%', '4.8%']
7 ['Technology spending', '5.9% 5.3% (6.7%)', '6.8%', '8.2%', '5.6%']
8 ['R&D spending', '3.9% 4.4% (5.1%)', '3.9%', '7.4%', '4.5%']
9 ['Employment û full-time', '5.1% 6.0% (2.7%)', '1.0%', '0.5%', '-0.2%']
10 ['Wages and Salaries', '5.3% 6.8% (6.7%)', '3.8%', '6.3%', '4.2%']
11 ['Inflation (Chg in prices of 0.1% own-firm products)', '3.4% 2.6% 1.2% (1.3%)', '-1.2% Median=0%', 'Median=2%', '']
12 ['Health Care Costs', '4.3% 2.7% (3.9%)', '2.0%', '4.1%', '4.0%']
13 ['Revenue', '3.7% 6.3% (7.3%)', '4.2%', '5.4%', '0.4%']
14 ['', 'Compared to last qtr.', 'Compared to last qtr.', 'Compared to last qtr.', 'Compared to last qtr.', 'Compared to last qtr.']
15 ['Optimism about', 'More opt: 33.9%', 'More opt: 29.1%', 'More opt: 32.5%', 'More opt: 36.2%', 'More opt: 32.5%']
16 ['the countryÆs', 'Less opt: 35.7%', 'Less opt: 37.6%', 'Less opt: 35.3%', 'Less opt: 44.3%', 'Less opt: 47.3%']
17 ['economy', 'No chg: 30.4%', 'No chg: 33.3%', 'No chg: 32.2%', 'No chg: 19.5%', 'No chg: 20.1%']
18 ['Country optimism', '', '', '', '', '']
19 ['level', '57.6', '58.6', '65.0', '56.8', '56.9']
20 ['Optimism about', 'More opt: 40.7%', 'More opt: 35.6%', 'More opt: 36.7%', 'More opt: 39.7%', 'More opt: 41.3%']
21 ['own company', 'Less opt: 25.8% No chg: 33.6%', 'Less opt: 35.3% No chg: 29.2%', 'Less opt: 30.4% No chg: 32.9%', 'Less opt: 33.2% No chg: 27.2%', 'Less opt: 37.1% No chg: 21.6%']
22 ['Own company', '', '', '', '', '']
23 ['optimism level', '59.9', '60.8', '66.7', '61.6', '60.7']
处理后,我希望csv文件的以下格式和suvh信息


所需的输出是什么?有很多事情让我很难理解最终结果应该是什么样子。此外,这些数据的最终目标是什么?这两个问题的答案将真正有助于指导我们的工作answers@MattR更新说明。