Add CLI documentation, clean cli example command

pull/2/head
Emmanuel Arias 2018-10-16 22:46:12 -03:00 committed by Vinayak Mehta
parent d662819755
commit 2dc48f43d6
1 changed files with 0 additions and 43 deletions

View File

@ -177,46 +177,3 @@ def stream(c, *args, **kwargs):
plt.show()
else:
tables.export(output, f=f, compress=compress)
@cli.command('examples')
def examples(*arg, **kwargs):
"""Usage example"""
sample = """
>>> import camelot
>>> tables = camelot.read_pdf('foo.pdf')
>>> tables
<TableList n=1>
>>> tables.export('foo.csv', f='csv', compress=True) # json, excel, html
>>> tables[0]
<Table shape=(7, 7)>
>>> tables[0].parsing_report
{
'accuracy': 99.02,
'whitespace': 12.24,
'order': 1,
'page': 1
}
>>> tables[0].to_csv('foo.csv') # to_json, to_excel, to_html
>>> tables[0].df # get a pandas DataFrame!
|-------|-----------|---------------|--------------|-----------|------------|-----------|
| Cycle | KI (1/km) | Distance (mi) | Percent | | | |
| Name | | | Fuel Savings | | | |
|-------|-----------|---------------|--------------|-----------|------------|-----------|
| | | | Improved | Decreased | Eliminate | Decreased |
| | | | Speed | Accel | Stops | Idle |
|-------|-----------|---------------|--------------|-----------|------------|-----------|
| 2012_2| 3.30 | 1.3 | 5.9% | 9.5% | 29.2% | 17.4% |
|-------|-----------|---------------|--------------|-----------|------------|-----------|
| 2145_1| 0.68 | 11.2 | 2.4% | 0.1% | 9.5% | 2.7% |
|-------|-----------|---------------|--------------|-----------|------------|-----------|
| 4234_1| 0.59 | 58.7 | 8.5% | 1.3% | 8.5% | 3.3% |
|-------|-----------|---------------|--------------|-----------|------------|-----------|
| 2032_2| 0.17 | 57.8 | 21.7% | 0.3% | 2.7% | 1.2% |
|-------|-----------|---------------|--------------|-----------|------------|-----------|
| 4171_1| 0.07 | 173.9 | 58.1% | 1.6% | 2.1% | 0.5% |
|-------|-----------|---------------|--------------|-----------|------------|-----------|
"""
print(sample)