Skip to content

Commit

Permalink
Fix issue #8
Browse files Browse the repository at this point in the history
- Added a new function loop to ask for a test the key
  • Loading branch information
tylerdq committed Aug 13, 2019
1 parent eb4bfb5 commit c37d888
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pdfca.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
import PyPDF2


def checkIndex(dataframe):
key = click.prompt('Please enter item to explore')
while True:
if key in dataframe.index:
return key
else:
key = click.prompt('Please enter a valid key')


def count(x, term):
search = re.findall(term.strip().lower(), x.strip().lower())
num = len(search)
Expand Down Expand Up @@ -235,9 +244,10 @@ def search(term, binary, form, search_type, number):
else:
results = dropped.sum().sort_values(by=[term])
click.echo(f'Top {number} results:')
click.echo(results.tail(number))
results = results.tail(number)
click.echo(results)
if click.confirm('\nWould you like to drill down?'):
key = click.prompt('Please enter item to explore')
key = checkIndex(results)
filtered = grouped.get_group(key).sort_values(by=[term])
filtered = filtered.set_index('page')
click.echo()
Expand Down

0 comments on commit c37d888

Please sign in to comment.