问题描述
当我使用Tabula将pdf转换为数据框时,我以列表形式获取表格。 如何将其转换为dataframe。 使用的代码:
file_path = './hospitals.pdf'
from tabula import read_pdf
pdf_df = read_pdf(file_path,pages='all')
输出为:
[ Unnamed: 0 id lat lng \
0 0 hospital_001 -37.990622 145.072836
1 1 hospital_002 -37.855469 145.268183
2 2 hospital_003 -37.792230 144.889128
3 3 hospital_004 -37.756042 145.061896
4 4 hospital_005 -37.760623 144.815624
5 5 hospital_006 -36.359274 145.410832
6 6 hospital_007 -37.774573 144.923973
7 7 hospital_008 -37.849467 145.226801
8 8 hospital_009 -37.869801 145.003096
9 9 hospital_010 -37.810454 145.194100
10 10 hospital_011 -37.754592 144.958277
11 11 hospital_012 -37.854654 144.998759
12 12 hospital_013 -37.896305 145.013206
13 13 hospital_014 -37.814309 145.118569
14 14 hospital_015 -36.138197 144.748819
15 15 hospital_016 -36.993135 144.064656
16 16 hospital_017 -38.159850 145.165998
17 17 hospital_018 -37.966621 145.194007
18 18 hospital_019 -36.362528 145.408591
19 19 hospital_020 -36.140570 141.987191
20 20 hospital_021 -36.378489 141.237173
21 21 hospital_022 -37.816144 144.965102
22 22 hospital_023 -36.741816 141.941948
23 23 hospital_024 -37.788107 144.952924
24 24 hospital_025 -37.716969 145.043174
25 25 hospital_026 -37.938613 145.213208
26 26 hospital_027 -35.895790 141.997177
27 27 hospital_028 -38.545479 143.980829
28 28 hospital_029 -37.789457 145.023888
29 29 hospital_030 -37.557401 143.847866
30 30 hospital_031 -37.563193 143.846701
31 31 hospital_032 -37.805271 145.015201
32 32 hospital_033 -37.976549 145.216359
33 33 hospital_034 -37.790391 145.172943
34 34 hospital_035 -37.762911 145.007846
35 35 hospital_036 -37.942429 145.003715
36 36 hospital_037 -37.701765 145.057284
37 37 hospital_038 -37.035202 141.289727
38 38 hospital_039 -37.763369 145.030778
39 39 hospital_040 -36.349300 146.312423
40 40 hospital_041 -37.691473 145.062939
41 41 hospital_042 -37.815077 144.998797
42 42 hospital_043 -38.148188 145.143379
43 43 hospital_044 -37.053433 144.213627
44 44 hospital_045 -35.799279 144.214445
45 45 hospital_046 -37.757785 145.059631
46 46 hospital_047 -37.842938 145.133670
47 47 hospital_048 -37.970011 145.213276
48 48 hospital_049 -37.862597 145.282709
name
0 Como Private Hospital
1 Mountain district Private Hospital
2 Western Hospital
3 Mercy Hospital for Women
4 Sunshine Hospital
5 Shepparton Private Hospital
6 Ascot Vale Road Specialist Rooms
7 Knox Private Hospital
8 Masada Private Hospital
9 Mitcham Private Hospital
10 John Fawkner Private Hospital
11 The Avenue Private Hospital
12 Calvary Health Care Bethlehem
13 Box Hill Hospital
14 Echuca Regional Health
15 Maldon Hospital
16 Peninsula Private Hospital
17 South Eastern Private Hospital
18 Goulburn Valley Health
19 Jeparit Hospital
20 Kaniva Hospital
21 Collins Street Medical Centre
22 Natimuk Hospital
23 The Melbourne Private Hospital
24 La Trobe Private Hospital
25 The Valley Private Hospital
26 Rainbow Hospital
27 Lorne Community Hospital
28 Royal Talbot Rehabilitation Centre
29 St John of God Hospital,Ballarat
30 Dr Edmund EK Plastic Reconstructive & Aestheti...
31 Caritas Christi
32 Dandenong Hospital
33 Donvale Rehabilitation Hospital
34 Olympia Private Rehabilitation Hospital
35 Linacre Private Hospital
36 Bundoora Extended Care Centre
37 Edenhope and district Hospital
38 Ivanhoe Private Rehabilitation Hospital
39 Wangaratta Private Hospital
40 northpark Private Hospital
41 Melbourne Neuropsychiatry
42 Bayside Day Procedure and Specialist Centre
43 Mt Alexander Hospital
44 Cohuna district Hospital
45 Austin Hospital
46 Middleborough Dental Care
47 St John of God Pinelodge Clinic
48 Boronia Medical Centre ]
我想将其放入数据框而不是列表中
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)