<commit_before>import json
from datetime import datetime
from io import BytesIO

import matplotlib as mpl
import numpy as np
import pandas as pd
import requests
from matplotlib import pyplot as plt


def get_weather_df(username, password, port, url, zipcode):
    line = 'https://'+username+':'+password+'@tw<EMAIL>.mybluemix.<EMAIL>:'+port+'/api/weather/v1/location/'+zipcode+'%3A4%3AUS/forecast/hourly/48hour.json?units=m&language=en-US'
    raw = requests.get(line)
    weather = json.loads(raw.text)
    df = pd.DataFrame.from_dict(weather['forecasts'][0],orient='index').transpose()
    for forecast in weather['forecasts'][1:]:
      df = pd.concat([df, pd.DataFrame.from_dict(forecast,orient='index').transpose()])

    time = np.array(df['fcst_valid_local'])
    for row in range(len(time)):
      time[row] = datetime.strptime(time[row], '%Y-%m-%dT%H:%M:%S%z')

    df = df.set_index(time)
    return df


def get_weather_plots(df):<commit_msg>testing backends...<commit_after>import json
from datetime import datetime
from io import BytesIO

import matplotlib as mpl
import numpy as np
import pandas as pd
import requests

mpl.use('agg')
from matplotlib import pyplot as plt


def get_weather_df(username, password, port, url, zipcode):
    line = 'https://'+username+':'+password+'@tw<EMAIL>.myblue<EMAIL>:'+port+'/api/weather/v1/location/'+zipcode+'%3A4%3AUS/forecast/hourly/48hour.json?units=m&language=en-US'
    raw = requests.get(line)
    weather = json.loads(raw.text)
    df = pd.DataFrame.from_dict(weather['forecasts'][0],orient='index').transpose()
    for forecast in weather['forecasts'][1:]:
      df = pd.concat([df, pd.DataFrame.from_dict(forecast,orient='index').transpose()])

    time = np.array(df['fcst_valid_local'])
    for row in range(len(time)):
      time[row] = datetime.strptime(time[row], '%Y-%m-%dT%H:%M:%S%z')

    df = df.set_index(time)
    return df


def get_weather_plots(df):
{'fraction_non_alphanumeric': 0.16164241164241164, 'fraction_numerical': 0.008316008316008316, 'mean_word_length': 4.996884735202492, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3157683', 'n_tokens_mistral': 696, 'n_tokens_neox': 682, 'n_words': 133}