Created
January 7, 2021 04:21
-
-
Save canimus/1292d6af370c6c65cf0f477165c12b1e to your computer and use it in GitHub Desktop.
termgraph test cases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/home/herminio/py385/bin/python | |
import glob | |
import json | |
import chalk | |
import asyncio | |
import aiofiles | |
import tabulate | |
import pandas as pd | |
import itertools as it | |
async def read_tags(f): | |
async with aiofiles.open(f, mode='r') as reader: | |
content = json.loads(await reader.read())['labels'] | |
return [x for x in map(lambda x: x['value'], content)] | |
files = glob.glob('./*.json') | |
tags = [] | |
for file in files: | |
tags.append(asyncio.run(read_tags(file))) | |
tag_set = set(it.chain.from_iterable(tags)) | |
df = pd.Series([*tag_set]).rename('tags').to_frame() | |
print(df.tags.str.split(":").apply(pd.Series).rename(columns={0:'tag', 1:'case'}).case.str.split("-").apply(pd.Series)[0].value_counts()) | |
# run script | |
# ./parser.py | grep -v ":" | termgraph --color black |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment