#!/usr/bin/env python
# coding: utf-8
import os
import re
import requests

from datetime import datetime
from bs4 import BeautifulSoup
from logya.core import Logya
from logya.path import slugify, target_file
from logya.writer import encode_content, write


logya = Logya()
logya.init_env()

url = 'https://en.wikipedia.org/wiki/Bodyweight_exercise'
html = requests.get(url).text
soup = BeautifulSoup(html, 'lxml')

replacements = {
    'bams': 'bam',
    'bodybuilders': 'bodybuilder',
    'boots': 'boot',
    'chairs': 'chair',
    'climbers': 'climber',
    'crosses': 'cross',
    'curls': 'curl',
    'darlings': 'darling',
    'dips': 'dip',
    'dogs': 'dog',
Пример #2
0
import pandas as pd

from datetime import datetime

from logya.core import Logya
from logya.writer import write, encode_content

parser = argparse.ArgumentParser(
    description='Create data map draft based on input CSV and arguments.')
parser.add_argument('input_file', help='Name of the input file.')
parser.add_argument('output_name',
                    help='Name part of the generated content and CSV files.')
args = parser.parse_args()

L = Logya()
L.init_env()

now = datetime.now()

# World Bank specific data loading and processing
df = pd.read_csv(args.input_file, skiprows=4).dropna(
    axis='columns', how='all',
    thresh=10).rename(columns={'Country Code': 'iso3'})

years = [str(year) for year in range(1960, now.year + 1) if str(year) in df]
columns = ['iso3'] + years
df_final = df[columns]

# Determine absolute min and max values for use in JS
abs_min = df.min(numeric_only=True).min()
if abs_min > 0 and abs_min < 1:
Пример #3
0
#!/usr/bin/env python
# coding: utf-8
import os
import re
import requests

from datetime import datetime
from bs4 import BeautifulSoup
from logya.core import Logya
from logya.path import slugify, target_file
from logya.writer import encode_content, write

logya = Logya()
logya.init_env()

url = 'https://en.wikipedia.org/wiki/Bodyweight_exercise'
html = requests.get(url).text
soup = BeautifulSoup(html, 'lxml')

replacements = {
    'bams': 'bam',
    'bodybuilders': 'bodybuilder',
    'boots': 'boot',
    'chairs': 'chair',
    'climbers': 'climber',
    'crosses': 'cross',
    'curls': 'curl',
    'darlings': 'darling',
    'dips': 'dip',
    'dogs': 'dog',
    'extensions': 'extension',