-
-
Save bernardolm/35c3c4b08d854bb07d076558e8e2b8a9 to your computer and use it in GitHub Desktop.
Resumo do arquivo de logs do github, rode esse script com python3 e com o pandas instalado (pip install pandas)
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
import sys | |
import pandas as pd | |
def parse_line(line): | |
return list(map(lambda l: l.strip(), line.split('|'))) | |
with open(sys.argv[1], 'r', encoding='utf8') as f: | |
lines = f.readlines() | |
[header, _, *rows] = lines | |
df = pd.DataFrame([parse_line(row) for row in rows]) | |
df.columns = parse_line(header) | |
print('Países') | |
print(df['country_code'].value_counts()) | |
print() | |
print('Cidades') | |
print(df['city'].value_counts()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment