Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New export format: markdown #222

Merged
merged 2 commits into from
Jun 27, 2021
Merged

New export format: markdown #222

merged 2 commits into from
Jun 27, 2021

Conversation

Lucas-C
Copy link
Contributor

@Lucas-C Lucas-C commented Jan 12, 2021

This PR leverages https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_markdown.html

Manual test:

# camelot --format markdown --output health.md stream tests/files/health.pdf
# cat health-page-1-table-1.md
|    | 0                 | 1          | 2         | 3          | 4       | 5          | 6          | 7          |
|---:|:------------------|:-----------|:----------|:-----------|:--------|:-----------|:-----------|:-----------|
|  0 | States-A          | Revenue    |           | Capital    |         | Total      | Others(1)  | Total      |
|  1 |                   |            |           |            |         | Revenue &  |            |            |
|  2 |                   | Medical &  | Family    | Medical &  | Family  |            |            |            |
|  3 |                   |            |           |            |         | Capital    |            |            |
|  4 |                   | Public     | Welfare   | Public     | Welfare |            |            |            |
|  5 |                   | Health     |           | Health     |         |            |            |            |
|  6 | Andhra Pradesh    | 47,824,589 | 9,967,837 | 1,275,000  | 15,000  | 59,082,426 | 14,898,243 | 73,980,669 |
|  7 | Arunachal Pradesh | 2,241,609  | 107,549   | 23,000     | 0       | 2,372,158  | 86,336     | 2,458,494  |
|  8 | Assam             | 14,874,821 | 2,554,197 | 161,600    | 0       | 17,590,618 | 4,408,505  | 21,999,123 |
|  9 | Bihar             | 21,016,708 | 4,332,141 | 5,329,000  | 0       | 30,677,849 | 2,251,571  | 32,929,420 |
| 10 | Chhattisgarh      | 11,427,311 | 1,415,660 | 2,366,592  | 0       | 15,209,563 | 311,163    | 15,520,726 |
| 11 | Delhi             | 28,084,780 | 411,700   | 4,550,000  | 0       | 33,046,480 | 5,000      | 33,051,480 |
| 12 | Goa               | 4,055,567  | 110,000   | 330,053    | 0       | 4,495,620  | 12,560     | 4,508,180  |
| 13 | Gujarat           | 26,328,400 | 6,922,900 | 12,664,000 | 42,000  | 45,957,300 | 455,860    | 46,413,160 |
| 14 | Haryana           | 15,156,681 | 1,333,527 | 40,100     | 0       | 16,530,308 | 1,222,698  | 17,753,006 |
| 15 | Himachal Pradesh  | 8,647,229  | 1,331,529 | 580,800    | 0       | 10,559,558 | 725,315    | 11,284,873 |
| 16 | Jammu & Kashmir   | 14,411,984 | 270,840   | 3,188,550  | 0       | 17,871,374 | 166,229    | 18,037,603 |
| 17 | Jharkhand         | 8,185,079  | 3,008,077 | 3,525,558  | 0       | 14,718,714 | 745,139    | 15,463,853 |
| 18 | Karnataka         | 34,939,843 | 4,317,801 | 3,669,700  | 0       | 42,927,344 | 631,088    | 43,558,432 |
| 19 | Kerala            | 27,923,965 | 3,985,473 | 929,503    | 0       | 32,838,941 | 334,640    | 33,173,581 |
| 20 | Madhya Pradesh    | 28,459,540 | 4,072,016 | 3,432,711  | 0       | 35,964,267 | 472,139    | 36,436,406 |
| 21 | Maharashtra       | 55,011,100 | 6,680,721 | 5,038,576  | 0       | 66,730,397 | 313,762    | 67,044,159 |
| 22 | Manipur           | 2,494,600  | 187,700   | 897,400    | 0       | 3,579,700  | 0          | 3,579,700  |
| 23 | Meghalaya         | 2,894,093  | 342,893   | 705,500    | 5,000   | 3,947,486  | 24,128     | 3,971,614  |
| 24 | Mizoram           | 1,743,501  | 84,185    | 10,250     | 0       | 1,837,936  | 17,060     | 1,854,996  |
| 25 | Nagaland          | 2,368,724  | 204,329   | 226,400    | 0       | 2,799,453  | 783,054    | 3,582,507  |
| 26 | Odisha            | 14,317,179 | 2,552,292 | 1,107,250  | 0       | 17,976,721 | 451,438    | 18,428,159 |
| 27 | Puducherry        | 4,191,757  | 52,249    | 192,400    | 0       | 4,436,406  | 2,173      | 4,438,579  |
| 28 | Punjab            | 19,775,485 | 2,208,343 | 2,470,882  | 0       | 24,454,710 | 1,436,522  | 25,891,232 |

@codecov-io
Copy link

Codecov Report

Merging #222 (955e4b6) into master (7709e58) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #222      +/-   ##
==========================================
+ Coverage   88.35%   88.38%   +0.02%     
==========================================
  Files          14       14              
  Lines        1571     1575       +4     
  Branches      358      358              
==========================================
+ Hits         1388     1392       +4     
  Misses        128      128              
  Partials       55       55              
Impacted Files Coverage Δ
camelot/cli.py 86.66% <ø> (ø)
camelot/core.py 87.66% <100.00%> (+0.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7709e58...955e4b6. Read the comment docs.

@Lucas-C
Copy link
Contributor Author

Lucas-C commented Jan 13, 2021

This is ready for review :)

@vinayak-mehta
Copy link
Member

Thanks for the PR! LGTM :)

@vinayak-mehta vinayak-mehta merged commit 56efcaa into camelot-dev:master Jun 27, 2021
@vinayak-mehta
Copy link
Member

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants