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
# primitives | |
def literal(lit): | |
def parse(input): | |
if len(input) > 0 and input[0] == lit: | |
return input[1:] | |
else: | |
return False | |
return parse |
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
def make_table(locations, variable): | |
columns = {} | |
for location in locations: | |
path = "C:\Users\Diego.Diego-PC\Documents\RDCEP\Experiments\DSSAT Outputs\\" + location + '.dssat_output' | |
table = pd.read_csv(path, skiprows=3, sep=' ', skipinitialspace=1) | |
columns[location] = table[variable] | |
return pd.DataFrame(data=columns) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
// Java | |
class Point { | |
int x; | |
int y; | |
public Point(int x, int y) { | |
x | |
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
def write_to_db(conn, file): | |
df = pd.read_csv(file, parse_dates=[1]) | |
df2 = df.rename(columns={'dataid': 'house_id', 'use': 'total_energy'}) | |
df3 = df2.fillna(0) | |
df3.utc = df3.utc.map(str) | |
sql.write_frame(df3, con=conn, name='readings', if_exists='append', flavor='mysql') | |
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
from netCDF4 import Dataset | |
ds = Dataset('Wheat.NetCDF') | |
ds | |
hwam = ds.variables['HWAM'] | |
hwam.dimensions | |
hwam.shape | |
data = hwam[:] | |
reshaped = data.reshape(150, 8) | |
reshaped | |
import pandas as pd |
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 pandas as pd | |
import os | |
import re | |
def df_for_all_houses(year, month): | |
"""month: number""" | |
dir_name = 'A-{0}-{1:02d}'.format(year, month) | |
dir_path = 'Home Group A/{0}'.format(dir_name) | |
use_series = {} | |
for entry in os.listdir(dir_path): |
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
[Jun 27 15:34:27.967] Initializing community_wsgi.ini from community_wsgi.ini.sample | |
[Jun 27 15:34:27.972] Initializing tool_parameters_conf.xml from tool_parameters_conf.xml.sample | |
[Jun 27 15:34:27.975] Initializing external_service_types_conf.xml from external_service_types_conf.xml.sample | |
[Jun 27 15:34:28.104] Initializing reports_wsgi.ini from reports_wsgi.ini.sample | |
[Jun 27 15:34:28.107] Initializing shed_tool_conf.xml from shed_tool_conf.xml.sample | |
[Jun 27 15:34:28.111] Initializing tool_conf.xml from tool_conf.xml.sample | |
[Jun 27 15:34:28.242] Initializing tool_sheds_conf.xml from tool_sheds_conf.xml.sample | |
[Jun 27 15:34:28.246] Initializing openid_conf.xml from openid_conf.xml.sample | |
[Jun 27 15:34:28.382] Initializing tool-data/add_scores.loc from add_scores.loc.sample | |
[Jun 27 15:34:28.385] Initializing tool-data/alignseq.loc from alignseq.loc.sample |
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 csv | |
import datetime | |
import time | |
import pprint | |
import itertools | |
def get_data(): | |
f = open('DATA_1334.csv') |