repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
eventable/vobject
vobject/vcard.py
serializeFields
def serializeFields(obj, order=None): """ Turn an object's fields into a ';' and ',' seperated string. If order is None, obj should be a list, backslash escape each field and return a ';' separated string. """ fields = [] if order is None: fields = [backslashEscape(val) for val in o...
python
def serializeFields(obj, order=None): """ Turn an object's fields into a ';' and ',' seperated string. If order is None, obj should be a list, backslash escape each field and return a ';' separated string. """ fields = [] if order is None: fields = [backslashEscape(val) for val in o...
[ "def", "serializeFields", "(", "obj", ",", "order", "=", "None", ")", ":", "fields", "=", "[", "]", "if", "order", "is", "None", ":", "fields", "=", "[", "backslashEscape", "(", "val", ")", "for", "val", "in", "obj", "]", "else", ":", "for", "field...
Turn an object's fields into a ';' and ',' seperated string. If order is None, obj should be a list, backslash escape each field and return a ';' separated string.
[ "Turn", "an", "object", "s", "fields", "into", "a", ";", "and", "seperated", "string", "." ]
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/vcard.py#L264-L279
eventable/vobject
vobject/vcard.py
Address.toString
def toString(val, join_char='\n'): """ Turn a string or array value into a string. """ if type(val) in (list, tuple): return join_char.join(val) return val
python
def toString(val, join_char='\n'): """ Turn a string or array value into a string. """ if type(val) in (list, tuple): return join_char.join(val) return val
[ "def", "toString", "(", "val", ",", "join_char", "=", "'\\n'", ")", ":", "if", "type", "(", "val", ")", "in", "(", "list", ",", "tuple", ")", ":", "return", "join_char", ".", "join", "(", "val", ")", "return", "val" ]
Turn a string or array value into a string.
[ "Turn", "a", "string", "or", "array", "value", "into", "a", "string", "." ]
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/vcard.py#L75-L81
eventable/vobject
vobject/vcard.py
VCardTextBehavior.encode
def encode(cls, line): """ Backslash escape line.value. """ if not line.encoded: encoding = getattr(line, 'encoding_param', None) if encoding and encoding.upper() == cls.base64string: if isinstance(line.value, bytes): line.value...
python
def encode(cls, line): """ Backslash escape line.value. """ if not line.encoded: encoding = getattr(line, 'encoding_param', None) if encoding and encoding.upper() == cls.base64string: if isinstance(line.value, bytes): line.value...
[ "def", "encode", "(", "cls", ",", "line", ")", ":", "if", "not", "line", ".", "encoded", ":", "encoding", "=", "getattr", "(", "line", ",", "'encoding_param'", ",", "None", ")", "if", "encoding", "and", "encoding", ".", "upper", "(", ")", "==", "cls"...
Backslash escape line.value.
[ "Backslash", "escape", "line", ".", "value", "." ]
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/vcard.py#L149-L162
eventable/vobject
vobject/vcard.py
VCard3_0.generateImplicitParameters
def generateImplicitParameters(cls, obj): """ Create PRODID, VERSION, and VTIMEZONEs if needed. VTIMEZONEs will need to exist whenever TZID parameters exist or when datetimes with tzinfo exist. """ if not hasattr(obj, 'version'): obj.add(ContentLine('VERSION'...
python
def generateImplicitParameters(cls, obj): """ Create PRODID, VERSION, and VTIMEZONEs if needed. VTIMEZONEs will need to exist whenever TZID parameters exist or when datetimes with tzinfo exist. """ if not hasattr(obj, 'version'): obj.add(ContentLine('VERSION'...
[ "def", "generateImplicitParameters", "(", "cls", ",", "obj", ")", ":", "if", "not", "hasattr", "(", "obj", ",", "'version'", ")", ":", "obj", ".", "add", "(", "ContentLine", "(", "'VERSION'", ",", "[", "]", ",", "cls", ".", "versionString", ")", ")" ]
Create PRODID, VERSION, and VTIMEZONEs if needed. VTIMEZONEs will need to exist whenever TZID parameters exist or when datetimes with tzinfo exist.
[ "Create", "PRODID", "VERSION", "and", "VTIMEZONEs", "if", "needed", "." ]
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/vcard.py#L193-L201
eventable/vobject
vobject/vcard.py
Photo.serialize
def serialize(cls, obj, buf, lineLength, validate): """ Apple's Address Book is *really* weird with images, it expects base64 data to have very specific whitespace. It seems Address Book can handle PHOTO if it's not wrapped, so don't wrap it. """ if wacky_apple_photo_ser...
python
def serialize(cls, obj, buf, lineLength, validate): """ Apple's Address Book is *really* weird with images, it expects base64 data to have very specific whitespace. It seems Address Book can handle PHOTO if it's not wrapped, so don't wrap it. """ if wacky_apple_photo_ser...
[ "def", "serialize", "(", "cls", ",", "obj", ",", "buf", ",", "lineLength", ",", "validate", ")", ":", "if", "wacky_apple_photo_serialize", ":", "lineLength", "=", "REALLY_LARGE", "VCardTextBehavior", ".", "serialize", "(", "obj", ",", "buf", ",", "lineLength",...
Apple's Address Book is *really* weird with images, it expects base64 data to have very specific whitespace. It seems Address Book can handle PHOTO if it's not wrapped, so don't wrap it.
[ "Apple", "s", "Address", "Book", "is", "*", "really", "*", "weird", "with", "images", "it", "expects", "base64", "data", "to", "have", "very", "specific", "whitespace", ".", "It", "seems", "Address", "Book", "can", "handle", "PHOTO", "if", "it", "s", "no...
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/vcard.py#L229-L237
eventable/vobject
vobject/vcard.py
NameBehavior.transformToNative
def transformToNative(obj): """ Turn obj.value into a Name. """ if obj.isNative: return obj obj.isNative = True obj.value = Name(**dict(zip(NAME_ORDER, splitFields(obj.value)))) return obj
python
def transformToNative(obj): """ Turn obj.value into a Name. """ if obj.isNative: return obj obj.isNative = True obj.value = Name(**dict(zip(NAME_ORDER, splitFields(obj.value)))) return obj
[ "def", "transformToNative", "(", "obj", ")", ":", "if", "obj", ".", "isNative", ":", "return", "obj", "obj", ".", "isNative", "=", "True", "obj", ".", "value", "=", "Name", "(", "*", "*", "dict", "(", "zip", "(", "NAME_ORDER", ",", "splitFields", "("...
Turn obj.value into a Name.
[ "Turn", "obj", ".", "value", "into", "a", "Name", "." ]
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/vcard.py#L294-L302
eventable/vobject
vobject/vcard.py
NameBehavior.transformFromNative
def transformFromNative(obj): """ Replace the Name in obj.value with a string. """ obj.isNative = False obj.value = serializeFields(obj.value, NAME_ORDER) return obj
python
def transformFromNative(obj): """ Replace the Name in obj.value with a string. """ obj.isNative = False obj.value = serializeFields(obj.value, NAME_ORDER) return obj
[ "def", "transformFromNative", "(", "obj", ")", ":", "obj", ".", "isNative", "=", "False", "obj", ".", "value", "=", "serializeFields", "(", "obj", ".", "value", ",", "NAME_ORDER", ")", "return", "obj" ]
Replace the Name in obj.value with a string.
[ "Replace", "the", "Name", "in", "obj", ".", "value", "with", "a", "string", "." ]
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/vcard.py#L305-L311
eventable/vobject
vobject/vcard.py
AddressBehavior.transformToNative
def transformToNative(obj): """ Turn obj.value into an Address. """ if obj.isNative: return obj obj.isNative = True obj.value = Address(**dict(zip(ADDRESS_ORDER, splitFields(obj.value)))) return obj
python
def transformToNative(obj): """ Turn obj.value into an Address. """ if obj.isNative: return obj obj.isNative = True obj.value = Address(**dict(zip(ADDRESS_ORDER, splitFields(obj.value)))) return obj
[ "def", "transformToNative", "(", "obj", ")", ":", "if", "obj", ".", "isNative", ":", "return", "obj", "obj", ".", "isNative", "=", "True", "obj", ".", "value", "=", "Address", "(", "*", "*", "dict", "(", "zip", "(", "ADDRESS_ORDER", ",", "splitFields",...
Turn obj.value into an Address.
[ "Turn", "obj", ".", "value", "into", "an", "Address", "." ]
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/vcard.py#L322-L330
eventable/vobject
vobject/vcard.py
OrgBehavior.transformToNative
def transformToNative(obj): """ Turn obj.value into a list. """ if obj.isNative: return obj obj.isNative = True obj.value = splitFields(obj.value) return obj
python
def transformToNative(obj): """ Turn obj.value into a list. """ if obj.isNative: return obj obj.isNative = True obj.value = splitFields(obj.value) return obj
[ "def", "transformToNative", "(", "obj", ")", ":", "if", "obj", ".", "isNative", ":", "return", "obj", "obj", ".", "isNative", "=", "True", "obj", ".", "value", "=", "splitFields", "(", "obj", ".", "value", ")", "return", "obj" ]
Turn obj.value into a list.
[ "Turn", "obj", ".", "value", "into", "a", "list", "." ]
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/vcard.py#L350-L358
eventable/vobject
docs/build/lib/vobject/vcard.py
VCardTextBehavior.decode
def decode(cls, line): """ Remove backslash escaping from line.valueDecode line, either to remove backslash espacing, or to decode base64 encoding. The content line should contain a ENCODING=b for base64 encoding, but Apple Addressbook seems to export a singleton parameter of 'BA...
python
def decode(cls, line): """ Remove backslash escaping from line.valueDecode line, either to remove backslash espacing, or to decode base64 encoding. The content line should contain a ENCODING=b for base64 encoding, but Apple Addressbook seems to export a singleton parameter of 'BA...
[ "def", "decode", "(", "cls", ",", "line", ")", ":", "if", "line", ".", "encoded", ":", "if", "'BASE64'", "in", "line", ".", "singletonparams", ":", "line", ".", "singletonparams", ".", "remove", "(", "'BASE64'", ")", "line", ".", "encoding_param", "=", ...
Remove backslash escaping from line.valueDecode line, either to remove backslash espacing, or to decode base64 encoding. The content line should contain a ENCODING=b for base64 encoding, but Apple Addressbook seems to export a singleton parameter of 'BASE64', which does not match the 3.0 ...
[ "Remove", "backslash", "escaping", "from", "line", ".", "valueDecode", "line", "either", "to", "remove", "backslash", "espacing", "or", "to", "decode", "base64", "encoding", ".", "The", "content", "line", "should", "contain", "a", "ENCODING", "=", "b", "for", ...
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/docs/build/lib/vobject/vcard.py#L124-L142
eventable/vobject
vobject/behavior.py
Behavior.validate
def validate(cls, obj, raiseException=False, complainUnrecognized=False): """Check if the object satisfies this behavior's requirements. @param obj: The L{ContentLine<base.ContentLine>} or L{Component<base.Component>} to be validated. @param raiseException: I...
python
def validate(cls, obj, raiseException=False, complainUnrecognized=False): """Check if the object satisfies this behavior's requirements. @param obj: The L{ContentLine<base.ContentLine>} or L{Component<base.Component>} to be validated. @param raiseException: I...
[ "def", "validate", "(", "cls", ",", "obj", ",", "raiseException", "=", "False", ",", "complainUnrecognized", "=", "False", ")", ":", "if", "not", "cls", ".", "allowGroup", "and", "obj", ".", "group", "is", "not", "None", ":", "err", "=", "\"{0} has a gro...
Check if the object satisfies this behavior's requirements. @param obj: The L{ContentLine<base.ContentLine>} or L{Component<base.Component>} to be validated. @param raiseException: If True, raise a L{base.ValidateError} on validation failure. Otherwise re...
[ "Check", "if", "the", "object", "satisfies", "this", "behavior", "s", "requirements", "." ]
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/behavior.py#L63-L103
eventable/vobject
vobject/behavior.py
Behavior.serialize
def serialize(cls, obj, buf, lineLength, validate=True): """ Set implicit parameters, do encoding, return unicode string. If validate is True, raise VObjectError if the line doesn't validate after implicit parameters are generated. Default is to call base.defaultSerialize. ...
python
def serialize(cls, obj, buf, lineLength, validate=True): """ Set implicit parameters, do encoding, return unicode string. If validate is True, raise VObjectError if the line doesn't validate after implicit parameters are generated. Default is to call base.defaultSerialize. ...
[ "def", "serialize", "(", "cls", ",", "obj", ",", "buf", ",", "lineLength", ",", "validate", "=", "True", ")", ":", "cls", ".", "generateImplicitParameters", "(", "obj", ")", "if", "validate", ":", "cls", ".", "validate", "(", "obj", ",", "raiseException"...
Set implicit parameters, do encoding, return unicode string. If validate is True, raise VObjectError if the line doesn't validate after implicit parameters are generated. Default is to call base.defaultSerialize.
[ "Set", "implicit", "parameters", "do", "encoding", "return", "unicode", "string", "." ]
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/behavior.py#L144-L169
eventable/vobject
vobject/win32tz.py
list_timezones
def list_timezones(): """Return a list of all time zones known to the system.""" l = [] for i in xrange(parentsize): l.append(_winreg.EnumKey(tzparent, i)) return l
python
def list_timezones(): """Return a list of all time zones known to the system.""" l = [] for i in xrange(parentsize): l.append(_winreg.EnumKey(tzparent, i)) return l
[ "def", "list_timezones", "(", ")", ":", "l", "=", "[", "]", "for", "i", "in", "xrange", "(", "parentsize", ")", ":", "l", ".", "append", "(", "_winreg", ".", "EnumKey", "(", "tzparent", ",", "i", ")", ")", "return", "l" ]
Return a list of all time zones known to the system.
[ "Return", "a", "list", "of", "all", "time", "zones", "known", "to", "the", "system", "." ]
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/win32tz.py#L15-L20
eventable/vobject
vobject/win32tz.py
pickNthWeekday
def pickNthWeekday(year, month, dayofweek, hour, minute, whichweek): """dayofweek == 0 means Sunday, whichweek > 4 means last instance""" first = datetime.datetime(year=year, month=month, hour=hour, minute=minute, day=1) weekdayone = first.replace(day=((dayofweek - first.isowee...
python
def pickNthWeekday(year, month, dayofweek, hour, minute, whichweek): """dayofweek == 0 means Sunday, whichweek > 4 means last instance""" first = datetime.datetime(year=year, month=month, hour=hour, minute=minute, day=1) weekdayone = first.replace(day=((dayofweek - first.isowee...
[ "def", "pickNthWeekday", "(", "year", ",", "month", ",", "dayofweek", ",", "hour", ",", "minute", ",", "whichweek", ")", ":", "first", "=", "datetime", ".", "datetime", "(", "year", "=", "year", ",", "month", "=", "month", ",", "hour", "=", "hour", "...
dayofweek == 0 means Sunday, whichweek > 4 means last instance
[ "dayofweek", "==", "0", "means", "Sunday", "whichweek", ">", "4", "means", "last", "instance" ]
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/win32tz.py#L77-L85
eventable/vobject
vobject/win32tz.py
valuesToDict
def valuesToDict(key): """Convert a registry key's values to a dictionary.""" d = {} size = _winreg.QueryInfoKey(key)[1] for i in xrange(size): d[_winreg.EnumValue(key, i)[0]] = _winreg.EnumValue(key, i)[1] return d
python
def valuesToDict(key): """Convert a registry key's values to a dictionary.""" d = {} size = _winreg.QueryInfoKey(key)[1] for i in xrange(size): d[_winreg.EnumValue(key, i)[0]] = _winreg.EnumValue(key, i)[1] return d
[ "def", "valuesToDict", "(", "key", ")", ":", "d", "=", "{", "}", "size", "=", "_winreg", ".", "QueryInfoKey", "(", "key", ")", "[", "1", "]", "for", "i", "in", "xrange", "(", "size", ")", ":", "d", "[", "_winreg", ".", "EnumValue", "(", "key", ...
Convert a registry key's values to a dictionary.
[ "Convert", "a", "registry", "key", "s", "values", "to", "a", "dictionary", "." ]
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/win32tz.py#L148-L154
eventable/vobject
docs/build/lib/vobject/ics_diff.py
diff
def diff(left, right): """ Take two VCALENDAR components, compare VEVENTs and VTODOs in them, return a list of object pairs containing just UID and the bits that didn't match, using None for objects that weren't present in one version or the other. When there are multiple ContentLines in one VE...
python
def diff(left, right): """ Take two VCALENDAR components, compare VEVENTs and VTODOs in them, return a list of object pairs containing just UID and the bits that didn't match, using None for objects that weren't present in one version or the other. When there are multiple ContentLines in one VE...
[ "def", "diff", "(", "left", ",", "right", ")", ":", "def", "processComponentLists", "(", "leftList", ",", "rightList", ")", ":", "output", "=", "[", "]", "rightIndex", "=", "0", "rightListSize", "=", "len", "(", "rightList", ")", "for", "comp", "in", "...
Take two VCALENDAR components, compare VEVENTs and VTODOs in them, return a list of object pairs containing just UID and the bits that didn't match, using None for objects that weren't present in one version or the other. When there are multiple ContentLines in one VEVENT, for instance many DESCRIP...
[ "Take", "two", "VCALENDAR", "components", "compare", "VEVENTs", "and", "VTODOs", "in", "them", "return", "a", "list", "of", "object", "pairs", "containing", "just", "UID", "and", "the", "bits", "that", "didn", "t", "match", "using", "None", "for", "objects",...
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/docs/build/lib/vobject/ics_diff.py#L47-L171
eventable/vobject
vobject/icalendar.py
stringToDateTime
def stringToDateTime(s, tzinfo=None): """ Returns datetime.datetime object. """ try: year = int(s[0:4]) month = int(s[4:6]) day = int(s[6:8]) hour = int(s[9:11]) minute = int(s[11:13]) second = int(s[13:15]) if len(s) > 15: if s[15] == ...
python
def stringToDateTime(s, tzinfo=None): """ Returns datetime.datetime object. """ try: year = int(s[0:4]) month = int(s[4:6]) day = int(s[6:8]) hour = int(s[9:11]) minute = int(s[11:13]) second = int(s[13:15]) if len(s) > 15: if s[15] == ...
[ "def", "stringToDateTime", "(", "s", ",", "tzinfo", "=", "None", ")", ":", "try", ":", "year", "=", "int", "(", "s", "[", "0", ":", "4", "]", ")", "month", "=", "int", "(", "s", "[", "4", ":", "6", "]", ")", "day", "=", "int", "(", "s", "...
Returns datetime.datetime object.
[ "Returns", "datetime", ".", "datetime", "object", "." ]
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/icalendar.py#L1726-L1745
eventable/vobject
vobject/icalendar.py
VCalendar2_0.serialize
def serialize(cls, obj, buf, lineLength, validate=True): """ Set implicit parameters, do encoding, return unicode string. If validate is True, raise VObjectError if the line doesn't validate after implicit parameters are generated. Default is to call base.defaultSerialize. ...
python
def serialize(cls, obj, buf, lineLength, validate=True): """ Set implicit parameters, do encoding, return unicode string. If validate is True, raise VObjectError if the line doesn't validate after implicit parameters are generated. Default is to call base.defaultSerialize. ...
[ "def", "serialize", "(", "cls", ",", "obj", ",", "buf", ",", "lineLength", ",", "validate", "=", "True", ")", ":", "cls", ".", "generateImplicitParameters", "(", "obj", ")", "if", "validate", ":", "cls", ".", "validate", "(", "obj", ",", "raiseException"...
Set implicit parameters, do encoding, return unicode string. If validate is True, raise VObjectError if the line doesn't validate after implicit parameters are generated. Default is to call base.defaultSerialize.
[ "Set", "implicit", "parameters", "do", "encoding", "return", "unicode", "string", "." ]
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/icalendar.py#L988-L1044
eventable/vobject
vobject/ics_diff.py
deleteExtraneous
def deleteExtraneous(component, ignore_dtstamp=False): """ Recursively walk the component's children, deleting extraneous details like X-VOBJ-ORIGINAL-TZID. """ for comp in component.components(): deleteExtraneous(comp, ignore_dtstamp) for line in component.lines(): if 'X-VOBJ-OR...
python
def deleteExtraneous(component, ignore_dtstamp=False): """ Recursively walk the component's children, deleting extraneous details like X-VOBJ-ORIGINAL-TZID. """ for comp in component.components(): deleteExtraneous(comp, ignore_dtstamp) for line in component.lines(): if 'X-VOBJ-OR...
[ "def", "deleteExtraneous", "(", "component", ",", "ignore_dtstamp", "=", "False", ")", ":", "for", "comp", "in", "component", ".", "components", "(", ")", ":", "deleteExtraneous", "(", "comp", ",", "ignore_dtstamp", ")", "for", "line", "in", "component", "."...
Recursively walk the component's children, deleting extraneous details like X-VOBJ-ORIGINAL-TZID.
[ "Recursively", "walk", "the", "component", "s", "children", "deleting", "extraneous", "details", "like", "X", "-", "VOBJ", "-", "ORIGINAL", "-", "TZID", "." ]
train
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/ics_diff.py#L37-L48
SoftwareDefinedBuildings/XBOS
apps/hole_filling/pelican/backfill.py
fillPelicanHole
def fillPelicanHole(site, username, password, tstat_name, start_time, end_time): """Fill a hole in a Pelican thermostat's data stream. Arguments: site -- The thermostat's Pelican site name username -- The Pelican username for the site password -- The Pelican password for the site ...
python
def fillPelicanHole(site, username, password, tstat_name, start_time, end_time): """Fill a hole in a Pelican thermostat's data stream. Arguments: site -- The thermostat's Pelican site name username -- The Pelican username for the site password -- The Pelican password for the site ...
[ "def", "fillPelicanHole", "(", "site", ",", "username", ",", "password", ",", "tstat_name", ",", "start_time", ",", "end_time", ")", ":", "start", "=", "datetime", ".", "strptime", "(", "start_time", ",", "_INPUT_TIME_FORMAT", ")", ".", "replace", "(", "tzin...
Fill a hole in a Pelican thermostat's data stream. Arguments: site -- The thermostat's Pelican site name username -- The Pelican username for the site password -- The Pelican password for the site tstat_name -- The name of the thermostat, as identified by Pelican start_time ...
[ "Fill", "a", "hole", "in", "a", "Pelican", "thermostat", "s", "data", "stream", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/hole_filling/pelican/backfill.py#L73-L137
SoftwareDefinedBuildings/XBOS
apps/data_analysis/XBOS_data_analytics/Preprocess_Data.py
Preprocess_Data.add_degree_days
def add_degree_days(self, col='OAT', hdh_cpoint=65, cdh_cpoint=65): """ Adds Heating & Cooling Degree Hours. Parameters ---------- col : str Column name which contains the outdoor air temperature. hdh_cpoint : int Heating degree hours. Defaults t...
python
def add_degree_days(self, col='OAT', hdh_cpoint=65, cdh_cpoint=65): """ Adds Heating & Cooling Degree Hours. Parameters ---------- col : str Column name which contains the outdoor air temperature. hdh_cpoint : int Heating degree hours. Defaults t...
[ "def", "add_degree_days", "(", "self", ",", "col", "=", "'OAT'", ",", "hdh_cpoint", "=", "65", ",", "cdh_cpoint", "=", "65", ")", ":", "if", "self", ".", "preprocessed_data", ".", "empty", ":", "data", "=", "self", ".", "original_data", "else", ":", "d...
Adds Heating & Cooling Degree Hours. Parameters ---------- col : str Column name which contains the outdoor air temperature. hdh_cpoint : int Heating degree hours. Defaults to 65. cdh_cpoint : int Cooling degree hours. Defaults to 65...
[ "Adds", "Heating", "&", "Cooling", "Degree", "Hours", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/data_analysis/XBOS_data_analytics/Preprocess_Data.py#L34-L65
SoftwareDefinedBuildings/XBOS
apps/data_analysis/XBOS_data_analytics/Preprocess_Data.py
Preprocess_Data.add_col_features
def add_col_features(self, col=None, degree=None): """ Exponentiate columns of dataframe. Basically this function squares/cubes a column. e.g. df[col^2] = pow(df[col], degree) where degree=2. Parameters ---------- col : list(str) Column to exponentiate....
python
def add_col_features(self, col=None, degree=None): """ Exponentiate columns of dataframe. Basically this function squares/cubes a column. e.g. df[col^2] = pow(df[col], degree) where degree=2. Parameters ---------- col : list(str) Column to exponentiate....
[ "def", "add_col_features", "(", "self", ",", "col", "=", "None", ",", "degree", "=", "None", ")", ":", "if", "not", "col", "and", "not", "degree", ":", "return", "else", ":", "if", "isinstance", "(", "col", ",", "list", ")", "and", "isinstance", "(",...
Exponentiate columns of dataframe. Basically this function squares/cubes a column. e.g. df[col^2] = pow(df[col], degree) where degree=2. Parameters ---------- col : list(str) Column to exponentiate. degree : list(str) Exponentiation degree.
[ "Exponentiate", "columns", "of", "dataframe", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/data_analysis/XBOS_data_analytics/Preprocess_Data.py#L68-L103
SoftwareDefinedBuildings/XBOS
apps/data_analysis/XBOS_data_analytics/Preprocess_Data.py
Preprocess_Data.standardize
def standardize(self): """ Standardize data. """ if self.preprocessed_data.empty: data = self.original_data else: data = self.preprocessed_data scaler = preprocessing.StandardScaler() data = pd.DataFrame(scaler.fit_transform(data), columns=data.c...
python
def standardize(self): """ Standardize data. """ if self.preprocessed_data.empty: data = self.original_data else: data = self.preprocessed_data scaler = preprocessing.StandardScaler() data = pd.DataFrame(scaler.fit_transform(data), columns=data.c...
[ "def", "standardize", "(", "self", ")", ":", "if", "self", ".", "preprocessed_data", ".", "empty", ":", "data", "=", "self", ".", "original_data", "else", ":", "data", "=", "self", ".", "preprocessed_data", "scaler", "=", "preprocessing", ".", "StandardScale...
Standardize data.
[ "Standardize", "data", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/data_analysis/XBOS_data_analytics/Preprocess_Data.py#L106-L116
SoftwareDefinedBuildings/XBOS
apps/data_analysis/XBOS_data_analytics/Preprocess_Data.py
Preprocess_Data.normalize
def normalize(self): """ Normalize data. """ if self.preprocessed_data.empty: data = self.original_data else: data = self.preprocessed_data data = pd.DataFrame(preprocessing.normalize(data), columns=data.columns, index=data.index) self.preprocessed_data ...
python
def normalize(self): """ Normalize data. """ if self.preprocessed_data.empty: data = self.original_data else: data = self.preprocessed_data data = pd.DataFrame(preprocessing.normalize(data), columns=data.columns, index=data.index) self.preprocessed_data ...
[ "def", "normalize", "(", "self", ")", ":", "if", "self", ".", "preprocessed_data", ".", "empty", ":", "data", "=", "self", ".", "original_data", "else", ":", "data", "=", "self", ".", "preprocessed_data", "data", "=", "pd", ".", "DataFrame", "(", "prepro...
Normalize data.
[ "Normalize", "data", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/data_analysis/XBOS_data_analytics/Preprocess_Data.py#L119-L128
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Preprocess_Data.py
Preprocess_Data.add_time_features
def add_time_features(self, year=False, month=False, week=True, tod=True, dow=True): """ Add time features to dataframe. Parameters ---------- year : bool Year. month : bool Month. week : bool Week. tod : bool ...
python
def add_time_features(self, year=False, month=False, week=True, tod=True, dow=True): """ Add time features to dataframe. Parameters ---------- year : bool Year. month : bool Month. week : bool Week. tod : bool ...
[ "def", "add_time_features", "(", "self", ",", "year", "=", "False", ",", "month", "=", "False", ",", "week", "=", "True", ",", "tod", "=", "True", ",", "dow", "=", "True", ")", ":", "var_to_expand", "=", "[", "]", "if", "self", ".", "preprocessed_dat...
Add time features to dataframe. Parameters ---------- year : bool Year. month : bool Month. week : bool Week. tod : bool Time of Day. dow : bool Day of Week.
[ "Add", "time", "features", "to", "dataframe", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Preprocess_Data.py#L135-L187
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Model_Data.py
Model_Data.split_data
def split_data(self): """ Split data according to baseline and projection time period values. """ try: # Extract data ranging in time_period1 time_period1 = (slice(self.baseline_period[0], self.baseline_period[1])) self.baseline_in = self.original_data.loc[time_perio...
python
def split_data(self): """ Split data according to baseline and projection time period values. """ try: # Extract data ranging in time_period1 time_period1 = (slice(self.baseline_period[0], self.baseline_period[1])) self.baseline_in = self.original_data.loc[time_perio...
[ "def", "split_data", "(", "self", ")", ":", "try", ":", "# Extract data ranging in time_period1", "time_period1", "=", "(", "slice", "(", "self", ".", "baseline_period", "[", "0", "]", ",", "self", ".", "baseline_period", "[", "1", "]", ")", ")", "self", "...
Split data according to baseline and projection time period values.
[ "Split", "data", "according", "to", "baseline", "and", "projection", "time", "period", "values", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Model_Data.py#L125-L152
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Model_Data.py
Model_Data.linear_regression
def linear_regression(self): """ Linear Regression. This function runs linear regression and stores the, 1. Model 2. Model name 3. Mean score of cross validation 4. Metrics """ model = LinearRegression() scores = [] kfold = KFold(n_sp...
python
def linear_regression(self): """ Linear Regression. This function runs linear regression and stores the, 1. Model 2. Model name 3. Mean score of cross validation 4. Metrics """ model = LinearRegression() scores = [] kfold = KFold(n_sp...
[ "def", "linear_regression", "(", "self", ")", ":", "model", "=", "LinearRegression", "(", ")", "scores", "=", "[", "]", "kfold", "=", "KFold", "(", "n_splits", "=", "self", ".", "cv", ",", "shuffle", "=", "True", ",", "random_state", "=", "42", ")", ...
Linear Regression. This function runs linear regression and stores the, 1. Model 2. Model name 3. Mean score of cross validation 4. Metrics
[ "Linear", "Regression", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Model_Data.py#L176-L203
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Model_Data.py
Model_Data.lasso_regression
def lasso_regression(self): """ Lasso Regression. This function runs lasso regression and stores the, 1. Model 2. Model name 3. Max score 4. Metrics """ score_list = [] max_score = float('-inf') best_alpha = None for alpha in se...
python
def lasso_regression(self): """ Lasso Regression. This function runs lasso regression and stores the, 1. Model 2. Model name 3. Max score 4. Metrics """ score_list = [] max_score = float('-inf') best_alpha = None for alpha in se...
[ "def", "lasso_regression", "(", "self", ")", ":", "score_list", "=", "[", "]", "max_score", "=", "float", "(", "'-inf'", ")", "best_alpha", "=", "None", "for", "alpha", "in", "self", ".", "alphas", ":", "# model = Lasso(normalize=True, alpha=alpha, max_iter=5000)"...
Lasso Regression. This function runs lasso regression and stores the, 1. Model 2. Model name 3. Max score 4. Metrics
[ "Lasso", "Regression", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Model_Data.py#L206-L246
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Model_Data.py
Model_Data.random_forest
def random_forest(self): """ Random Forest. This function runs random forest and stores the, 1. Model 2. Model name 3. Max score 4. Metrics """ model = RandomForestRegressor(random_state=42) scores = [] kfold = KFold(n_splits=self.cv, s...
python
def random_forest(self): """ Random Forest. This function runs random forest and stores the, 1. Model 2. Model name 3. Max score 4. Metrics """ model = RandomForestRegressor(random_state=42) scores = [] kfold = KFold(n_splits=self.cv, s...
[ "def", "random_forest", "(", "self", ")", ":", "model", "=", "RandomForestRegressor", "(", "random_state", "=", "42", ")", "scores", "=", "[", "]", "kfold", "=", "KFold", "(", "n_splits", "=", "self", ".", "cv", ",", "shuffle", "=", "True", ",", "rando...
Random Forest. This function runs random forest and stores the, 1. Model 2. Model name 3. Max score 4. Metrics
[ "Random", "Forest", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Model_Data.py#L338-L364
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Model_Data.py
Model_Data.run_models
def run_models(self): """ Run all models. Returns ------- model Best model dict Metrics of the models """ self.linear_regression() self.lasso_regression() self.ridge_regression() self.elastic_net_regression() ...
python
def run_models(self): """ Run all models. Returns ------- model Best model dict Metrics of the models """ self.linear_regression() self.lasso_regression() self.ridge_regression() self.elastic_net_regression() ...
[ "def", "run_models", "(", "self", ")", ":", "self", ".", "linear_regression", "(", ")", "self", ".", "lasso_regression", "(", ")", "self", ".", "ridge_regression", "(", ")", "self", ".", "elastic_net_regression", "(", ")", "self", ".", "random_forest", "(", ...
Run all models. Returns ------- model Best model dict Metrics of the models
[ "Run", "all", "models", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Model_Data.py#L396-L424
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Model_Data.py
Model_Data.custom_model
def custom_model(self, func): """ Run custom model provided by user. To Do, 1. Define custom function's parameters, its data types, and return types Parameters ---------- func : function Custom function Returns ------- dict ...
python
def custom_model(self, func): """ Run custom model provided by user. To Do, 1. Define custom function's parameters, its data types, and return types Parameters ---------- func : function Custom function Returns ------- dict ...
[ "def", "custom_model", "(", "self", ",", "func", ")", ":", "y_pred", "=", "func", "(", "self", ".", "baseline_in", ",", "self", ".", "baseline_out", ")", "self", ".", "custom_metrics", "=", "{", "}", "self", ".", "custom_metrics", "[", "'r2'", "]", "="...
Run custom model provided by user. To Do, 1. Define custom function's parameters, its data types, and return types Parameters ---------- func : function Custom function Returns ------- dict Custom function's metrics
[ "Run", "custom", "model", "provided", "by", "user", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Model_Data.py#L427-L453
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Model_Data.py
Model_Data.best_model_fit
def best_model_fit(self): """ Fit data to optimal model and return its metrics. Returns ------- dict Best model's metrics """ self.best_model.fit(self.baseline_in, self.baseline_out) self.y_true = self.baseline_out # Pan...
python
def best_model_fit(self): """ Fit data to optimal model and return its metrics. Returns ------- dict Best model's metrics """ self.best_model.fit(self.baseline_in, self.baseline_out) self.y_true = self.baseline_out # Pan...
[ "def", "best_model_fit", "(", "self", ")", ":", "self", ".", "best_model", ".", "fit", "(", "self", ".", "baseline_in", ",", "self", ".", "baseline_out", ")", "self", ".", "y_true", "=", "self", ".", "baseline_out", "# Pandas Series", "self", ".", "y_pred"...
Fit data to optimal model and return its metrics. Returns ------- dict Best model's metrics
[ "Fit", "data", "to", "optimal", "model", "and", "return", "its", "metrics", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Model_Data.py#L456-L497
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Plot_Data.py
Plot_Data.correlation_plot
def correlation_plot(self, data): """ Create heatmap of Pearson's correlation coefficient. Parameters ---------- data : pd.DataFrame() Data to display. Returns ------- matplotlib.figure Heatmap. """ # CHECK: Add saved...
python
def correlation_plot(self, data): """ Create heatmap of Pearson's correlation coefficient. Parameters ---------- data : pd.DataFrame() Data to display. Returns ------- matplotlib.figure Heatmap. """ # CHECK: Add saved...
[ "def", "correlation_plot", "(", "self", ",", "data", ")", ":", "# CHECK: Add saved filename in result.json", "fig", "=", "plt", ".", "figure", "(", "Plot_Data", ".", "count", ")", "corr", "=", "data", ".", "corr", "(", ")", "ax", "=", "sns", ".", "heatmap"...
Create heatmap of Pearson's correlation coefficient. Parameters ---------- data : pd.DataFrame() Data to display. Returns ------- matplotlib.figure Heatmap.
[ "Create", "heatmap", "of", "Pearson", "s", "correlation", "coefficient", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Plot_Data.py#L42-L63
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Plot_Data.py
Plot_Data.baseline_projection_plot
def baseline_projection_plot(self, y_true, y_pred, baseline_period, projection_period, model_name, adj_r2, data, input_col, output_col, model, site): """ Create baseline and projectio...
python
def baseline_projection_plot(self, y_true, y_pred, baseline_period, projection_period, model_name, adj_r2, data, input_col, output_col, model, site): """ Create baseline and projectio...
[ "def", "baseline_projection_plot", "(", "self", ",", "y_true", ",", "y_pred", ",", "baseline_period", ",", "projection_period", ",", "model_name", ",", "adj_r2", ",", "data", ",", "input_col", ",", "output_col", ",", "model", ",", "site", ")", ":", "# Baseline...
Create baseline and projection plots. Parameters ---------- y_true : pd.Series() Actual y values. y_pred : np.ndarray Predicted y values. baseline_period : list(str) Baseline period. projection_period : ...
[ "Create", "baseline", "and", "projection", "plots", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Plot_Data.py#L66-L147
SoftwareDefinedBuildings/XBOS
apps/system_identification/rtu_energy.py
get_thermostat_meter_data
def get_thermostat_meter_data(zone): """ This method subscribes to the output of the meter for the given zone. It returns a handler to call when you want to stop subscribing data, which returns a list of the data readins over that time period """ meter_uri = zone2meter.get(zone, "None") data...
python
def get_thermostat_meter_data(zone): """ This method subscribes to the output of the meter for the given zone. It returns a handler to call when you want to stop subscribing data, which returns a list of the data readins over that time period """ meter_uri = zone2meter.get(zone, "None") data...
[ "def", "get_thermostat_meter_data", "(", "zone", ")", ":", "meter_uri", "=", "zone2meter", ".", "get", "(", "zone", ",", "\"None\"", ")", "data", "=", "[", "]", "def", "cb", "(", "msg", ")", ":", "for", "po", "in", "msg", ".", "payload_objects", ":", ...
This method subscribes to the output of the meter for the given zone. It returns a handler to call when you want to stop subscribing data, which returns a list of the data readins over that time period
[ "This", "method", "subscribes", "to", "the", "output", "of", "the", "meter", "for", "the", "given", "zone", ".", "It", "returns", "a", "handler", "to", "call", "when", "you", "want", "to", "stop", "subscribing", "data", "which", "returns", "a", "list", "...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/system_identification/rtu_energy.py#L53-L71
SoftwareDefinedBuildings/XBOS
apps/system_identification/rtu_energy.py
call_heat
def call_heat(tstat): """ Adjusts the temperature setpoints in order to call for heating. Returns a handler to call when you want to reset the thermostat """ current_hsp, current_csp = tstat.heating_setpoint, tstat.cooling_setpoint current_temp = tstat.temperature tstat.write({ 'heat...
python
def call_heat(tstat): """ Adjusts the temperature setpoints in order to call for heating. Returns a handler to call when you want to reset the thermostat """ current_hsp, current_csp = tstat.heating_setpoint, tstat.cooling_setpoint current_temp = tstat.temperature tstat.write({ 'heat...
[ "def", "call_heat", "(", "tstat", ")", ":", "current_hsp", ",", "current_csp", "=", "tstat", ".", "heating_setpoint", ",", "tstat", ".", "cooling_setpoint", "current_temp", "=", "tstat", ".", "temperature", "tstat", ".", "write", "(", "{", "'heating_setpoint'", ...
Adjusts the temperature setpoints in order to call for heating. Returns a handler to call when you want to reset the thermostat
[ "Adjusts", "the", "temperature", "setpoints", "in", "order", "to", "call", "for", "heating", ".", "Returns", "a", "handler", "to", "call", "when", "you", "want", "to", "reset", "the", "thermostat" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/system_identification/rtu_energy.py#L73-L92
SoftwareDefinedBuildings/XBOS
apps/system_identification/rtu_energy.py
call_cool
def call_cool(tstat): """ Adjusts the temperature setpoints in order to call for cooling. Returns a handler to call when you want to reset the thermostat """ current_hsp, current_csp = tstat.heating_setpoint, tstat.cooling_setpoint current_temp = tstat.temperature tstat.write({ 'heat...
python
def call_cool(tstat): """ Adjusts the temperature setpoints in order to call for cooling. Returns a handler to call when you want to reset the thermostat """ current_hsp, current_csp = tstat.heating_setpoint, tstat.cooling_setpoint current_temp = tstat.temperature tstat.write({ 'heat...
[ "def", "call_cool", "(", "tstat", ")", ":", "current_hsp", ",", "current_csp", "=", "tstat", ".", "heating_setpoint", ",", "tstat", ".", "cooling_setpoint", "current_temp", "=", "tstat", ".", "temperature", "tstat", ".", "write", "(", "{", "'heating_setpoint'", ...
Adjusts the temperature setpoints in order to call for cooling. Returns a handler to call when you want to reset the thermostat
[ "Adjusts", "the", "temperature", "setpoints", "in", "order", "to", "call", "for", "cooling", ".", "Returns", "a", "handler", "to", "call", "when", "you", "want", "to", "reset", "the", "thermostat" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/system_identification/rtu_energy.py#L94-L113
SoftwareDefinedBuildings/XBOS
apps/system_identification/rtu_energy.py
call_fan
def call_fan(tstat): """ Toggles the fan """ old_fan = tstat.fan tstat.write({ 'fan': not old_fan, }) def restore(): tstat.write({ 'fan': old_fan, }) return restore
python
def call_fan(tstat): """ Toggles the fan """ old_fan = tstat.fan tstat.write({ 'fan': not old_fan, }) def restore(): tstat.write({ 'fan': old_fan, }) return restore
[ "def", "call_fan", "(", "tstat", ")", ":", "old_fan", "=", "tstat", ".", "fan", "tstat", ".", "write", "(", "{", "'fan'", ":", "not", "old_fan", ",", "}", ")", "def", "restore", "(", ")", ":", "tstat", ".", "write", "(", "{", "'fan'", ":", "old_f...
Toggles the fan
[ "Toggles", "the", "fan" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/system_identification/rtu_energy.py#L115-L129
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Import_Data.py
Import_Data.import_csv
def import_csv(self, file_name='*', folder_name='.', head_row=0, index_col=0, convert_col=True, concat_files=False): """ Imports csv file(s) and stores the result in data. Note ---- 1. If folder exists out of current directory, folder_name should contain correct regex ...
python
def import_csv(self, file_name='*', folder_name='.', head_row=0, index_col=0, convert_col=True, concat_files=False): """ Imports csv file(s) and stores the result in data. Note ---- 1. If folder exists out of current directory, folder_name should contain correct regex ...
[ "def", "import_csv", "(", "self", ",", "file_name", "=", "'*'", ",", "folder_name", "=", "'.'", ",", "head_row", "=", "0", ",", "index_col", "=", "0", ",", "convert_col", "=", "True", ",", "concat_files", "=", "False", ")", ":", "# Import a specific or all...
Imports csv file(s) and stores the result in data. Note ---- 1. If folder exists out of current directory, folder_name should contain correct regex 2. Assuming there's no file called "\*.csv" Parameters ---------- file_name : str CS...
[ "Imports", "csv", "file", "(", "s", ")", "and", "stores", "the", "result", "in", "data", ".", "Note", "----", "1", ".", "If", "folder", "exists", "out", "of", "current", "directory", "folder_name", "should", "contain", "correct", "regex", "2", ".", "Assu...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Import_Data.py#L44-L103
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Import_Data.py
Import_Data._load_csv
def _load_csv(self, file_name, folder_name, head_row, index_col, convert_col, concat_files): """ Load single csv file. Parameters ---------- file_name : str CSV file to be imported. Defaults to '*' - all csv files in the folder. folder_name : str ...
python
def _load_csv(self, file_name, folder_name, head_row, index_col, convert_col, concat_files): """ Load single csv file. Parameters ---------- file_name : str CSV file to be imported. Defaults to '*' - all csv files in the folder. folder_name : str ...
[ "def", "_load_csv", "(", "self", ",", "file_name", ",", "folder_name", ",", "head_row", ",", "index_col", ",", "convert_col", ",", "concat_files", ")", ":", "# Denotes all csv files", "if", "file_name", "==", "\"*\"", ":", "if", "not", "os", ".", "path", "."...
Load single csv file. Parameters ---------- file_name : str CSV file to be imported. Defaults to '*' - all csv files in the folder. folder_name : str Folder where file resides. Defaults to '.' - current directory. head_row : int ...
[ "Load", "single", "csv", "file", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Import_Data.py#L106-L174
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Import_Data.py
Import_MDAL.convert_to_utc
def convert_to_utc(time): """ Convert time to UTC Parameters ---------- time : str Time to convert. Has to be of the format '2016-01-01T00:00:00-08:00'. Returns ------- str UTC timestamp. """ # time is already in UTC ...
python
def convert_to_utc(time): """ Convert time to UTC Parameters ---------- time : str Time to convert. Has to be of the format '2016-01-01T00:00:00-08:00'. Returns ------- str UTC timestamp. """ # time is already in UTC ...
[ "def", "convert_to_utc", "(", "time", ")", ":", "# time is already in UTC", "if", "'Z'", "in", "time", ":", "return", "time", "else", ":", "time_formatted", "=", "time", "[", ":", "-", "3", "]", "+", "time", "[", "-", "2", ":", "]", "dt", "=", "datet...
Convert time to UTC Parameters ---------- time : str Time to convert. Has to be of the format '2016-01-01T00:00:00-08:00'. Returns ------- str UTC timestamp.
[ "Convert", "time", "to", "UTC" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Import_Data.py#L190-L212
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Import_Data.py
Import_MDAL.get_meter
def get_meter(self, site, start, end, point_type='Green_Button_Meter', var="meter", agg='MEAN', window='24h', aligned=True, return_names=True): """ Get meter data from MDAL. Parameters ---------- site : str Building name. start ...
python
def get_meter(self, site, start, end, point_type='Green_Button_Meter', var="meter", agg='MEAN', window='24h', aligned=True, return_names=True): """ Get meter data from MDAL. Parameters ---------- site : str Building name. start ...
[ "def", "get_meter", "(", "self", ",", "site", ",", "start", ",", "end", ",", "point_type", "=", "'Green_Button_Meter'", ",", "var", "=", "\"meter\"", ",", "agg", "=", "'MEAN'", ",", "window", "=", "'24h'", ",", "aligned", "=", "True", ",", "return_names"...
Get meter data from MDAL. Parameters ---------- site : str Building name. start : str Start date - 'YYYY-MM-DDTHH:MM:SSZ' end : str End date - 'YYYY-MM-DDTHH:MM:SSZ' point_type : str Ty...
[ "Get", "meter", "data", "from", "MDAL", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Import_Data.py#L215-L258
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Import_Data.py
Import_MDAL.get_tstat
def get_tstat(self, site, start, end, var="tstat_temp", agg='MEAN', window='24h', aligned=True, return_names=True): """ Get thermostat data from MDAL. Parameters ---------- site : str Building name. start : str Start date - 'YYYY-MM-D...
python
def get_tstat(self, site, start, end, var="tstat_temp", agg='MEAN', window='24h', aligned=True, return_names=True): """ Get thermostat data from MDAL. Parameters ---------- site : str Building name. start : str Start date - 'YYYY-MM-D...
[ "def", "get_tstat", "(", "self", ",", "site", ",", "start", ",", "end", ",", "var", "=", "\"tstat_temp\"", ",", "agg", "=", "'MEAN'", ",", "window", "=", "'24h'", ",", "aligned", "=", "True", ",", "return_names", "=", "True", ")", ":", "# Convert time ...
Get thermostat data from MDAL. Parameters ---------- site : str Building name. start : str Start date - 'YYYY-MM-DDTHH:MM:SSZ' end : str End date - 'YYYY-MM-DDTHH:MM:SSZ' var : str ...
[ "Get", "thermostat", "data", "from", "MDAL", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Import_Data.py#L307-L359
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Import_Data.py
Import_MDAL.compose_MDAL_dic
def compose_MDAL_dic(self, site, point_type, start, end, var, agg, window, aligned, points=None, return_names=False): """ Create dictionary for MDAL request. Parameters ---------- site : str Building name. start : str ...
python
def compose_MDAL_dic(self, site, point_type, start, end, var, agg, window, aligned, points=None, return_names=False): """ Create dictionary for MDAL request. Parameters ---------- site : str Building name. start : str ...
[ "def", "compose_MDAL_dic", "(", "self", ",", "site", ",", "point_type", ",", "start", ",", "end", ",", "var", ",", "agg", ",", "window", ",", "aligned", ",", "points", "=", "None", ",", "return_names", "=", "False", ")", ":", "# Convert time to UTC", "st...
Create dictionary for MDAL request. Parameters ---------- site : str Building name. start : str Start date - 'YYYY-MM-DDTHH:MM:SSZ' end : str End date - 'YYYY-MM-DDTHH:MM:SSZ' point_type : str ...
[ "Create", "dictionary", "for", "MDAL", "request", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Import_Data.py#L362-L428
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Import_Data.py
Import_MDAL.get_point_name
def get_point_name(self, context): """ Get point name. Parameters ---------- context : ??? ??? Returns ------- ??? ??? """ metadata_table = self.parse_context(context) return metadata_table.apply(self...
python
def get_point_name(self, context): """ Get point name. Parameters ---------- context : ??? ??? Returns ------- ??? ??? """ metadata_table = self.parse_context(context) return metadata_table.apply(self...
[ "def", "get_point_name", "(", "self", ",", "context", ")", ":", "metadata_table", "=", "self", ".", "parse_context", "(", "context", ")", "return", "metadata_table", ".", "apply", "(", "self", ".", "strip_point_name", ",", "axis", "=", "1", ")" ]
Get point name. Parameters ---------- context : ??? ??? Returns ------- ??? ???
[ "Get", "point", "name", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Import_Data.py#L510-L526
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Import_Data.py
Import_MDAL.replace_uuid_w_names
def replace_uuid_w_names(self, resp): """ Replace the uuid's with names. Parameters ---------- resp : ??? ??? Returns ------- ??? ??? """ col_mapper = self.get_point_name(resp.context)["?point"].to_dict() ...
python
def replace_uuid_w_names(self, resp): """ Replace the uuid's with names. Parameters ---------- resp : ??? ??? Returns ------- ??? ??? """ col_mapper = self.get_point_name(resp.context)["?point"].to_dict() ...
[ "def", "replace_uuid_w_names", "(", "self", ",", "resp", ")", ":", "col_mapper", "=", "self", ".", "get_point_name", "(", "resp", ".", "context", ")", "[", "\"?point\"", "]", ".", "to_dict", "(", ")", "resp", ".", "df", ".", "rename", "(", "columns", "...
Replace the uuid's with names. Parameters ---------- resp : ??? ??? Returns ------- ??? ???
[ "Replace", "the", "uuid", "s", "with", "names", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Import_Data.py#L529-L546
SoftwareDefinedBuildings/XBOS
apps/data_analysis/XBOS_data_analytics/Import_Data.py
Import_XBOS.get_weather_power_tstat
def get_weather_power_tstat(self, site, start, end, data_type=['weather', 'power']): """ Get weather and power data. Parameters ---------- site : str Site name. start : str Start date. end : str End date. d...
python
def get_weather_power_tstat(self, site, start, end, data_type=['weather', 'power']): """ Get weather and power data. Parameters ---------- site : str Site name. start : str Start date. end : str End date. d...
[ "def", "get_weather_power_tstat", "(", "self", ",", "site", ",", "start", ",", "end", ",", "data_type", "=", "[", "'weather'", ",", "'power'", "]", ")", ":", "m", "=", "dataclient", ".", "MDALClient", "(", "\"corbusier.cs.berkeley.edu:8088\"", ")", "request", ...
Get weather and power data. Parameters ---------- site : str Site name. start : str Start date. end : str End date. data_type : str Type of data needed (all, weather, power, temperature, hsp, csp)
[ "Get", "weather", "and", "power", "data", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/data_analysis/XBOS_data_analytics/Import_Data.py#L193-L318
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.drop_columns
def drop_columns(self, col): """ Drop columns in dataframe. Parameters ---------- col : str Column to drop. """ try: self.cleaned_data.drop(col, axis=1, inplace=True) except Exception as e: raise e
python
def drop_columns(self, col): """ Drop columns in dataframe. Parameters ---------- col : str Column to drop. """ try: self.cleaned_data.drop(col, axis=1, inplace=True) except Exception as e: raise e
[ "def", "drop_columns", "(", "self", ",", "col", ")", ":", "try", ":", "self", ".", "cleaned_data", ".", "drop", "(", "col", ",", "axis", "=", "1", ",", "inplace", "=", "True", ")", "except", "Exception", "as", "e", ":", "raise", "e" ]
Drop columns in dataframe. Parameters ---------- col : str Column to drop.
[ "Drop", "columns", "in", "dataframe", ".", "Parameters", "----------", "col", ":", "str", "Column", "to", "drop", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L46-L58
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.rename_columns
def rename_columns(self, col): """ Rename columns of dataframe. Parameters ---------- col : list(str) List of columns to rename. """ try: self.cleaned_data.columns = col except Exception as e: raise e
python
def rename_columns(self, col): """ Rename columns of dataframe. Parameters ---------- col : list(str) List of columns to rename. """ try: self.cleaned_data.columns = col except Exception as e: raise e
[ "def", "rename_columns", "(", "self", ",", "col", ")", ":", "try", ":", "self", ".", "cleaned_data", ".", "columns", "=", "col", "except", "Exception", "as", "e", ":", "raise", "e" ]
Rename columns of dataframe. Parameters ---------- col : list(str) List of columns to rename.
[ "Rename", "columns", "of", "dataframe", ".", "Parameters", "----------", "col", ":", "list", "(", "str", ")", "List", "of", "columns", "to", "rename", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L61-L73
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.resample_data
def resample_data(self, data, freq, resampler='mean'): """ Resample dataframe. Note ---- 1. Figure out how to apply different functions to different columns .apply() 2. This theoretically work in upsampling too, check docs http://pandas.pydata.org/pandas-docs/stable/...
python
def resample_data(self, data, freq, resampler='mean'): """ Resample dataframe. Note ---- 1. Figure out how to apply different functions to different columns .apply() 2. This theoretically work in upsampling too, check docs http://pandas.pydata.org/pandas-docs/stable/...
[ "def", "resample_data", "(", "self", ",", "data", ",", "freq", ",", "resampler", "=", "'mean'", ")", ":", "if", "resampler", "==", "'mean'", ":", "data", "=", "data", ".", "resample", "(", "freq", ")", ".", "mean", "(", ")", "elif", "resampler", "=="...
Resample dataframe. Note ---- 1. Figure out how to apply different functions to different columns .apply() 2. This theoretically work in upsampling too, check docs http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.resample.html Parameters ...
[ "Resample", "dataframe", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L76-L108
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.interpolate_data
def interpolate_data(self, data, limit, method): """ Interpolate dataframe. Parameters ---------- data : pd.DataFrame() Dataframe to interpolate limit : int Interpolation limit. method : str Interpolation method. Returns...
python
def interpolate_data(self, data, limit, method): """ Interpolate dataframe. Parameters ---------- data : pd.DataFrame() Dataframe to interpolate limit : int Interpolation limit. method : str Interpolation method. Returns...
[ "def", "interpolate_data", "(", "self", ",", "data", ",", "limit", ",", "method", ")", ":", "data", "=", "data", ".", "interpolate", "(", "how", "=", "\"index\"", ",", "limit", "=", "limit", ",", "method", "=", "method", ")", "return", "data" ]
Interpolate dataframe. Parameters ---------- data : pd.DataFrame() Dataframe to interpolate limit : int Interpolation limit. method : str Interpolation method. Returns ------- pd.DataFrame() Dataframe...
[ "Interpolate", "dataframe", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L111-L130
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.remove_na
def remove_na(self, data, remove_na_how): """ Remove NAs from dataframe. Parameters ---------- data : pd.DataFrame() Dataframe to remove NAs from. remove_na_how : str Specificies how to remove NA i.e. all, any... Returns ----...
python
def remove_na(self, data, remove_na_how): """ Remove NAs from dataframe. Parameters ---------- data : pd.DataFrame() Dataframe to remove NAs from. remove_na_how : str Specificies how to remove NA i.e. all, any... Returns ----...
[ "def", "remove_na", "(", "self", ",", "data", ",", "remove_na_how", ")", ":", "data", "=", "data", ".", "dropna", "(", "how", "=", "remove_na_how", ")", "return", "data" ]
Remove NAs from dataframe. Parameters ---------- data : pd.DataFrame() Dataframe to remove NAs from. remove_na_how : str Specificies how to remove NA i.e. all, any... Returns ------- pd.DataFrame() Dataframe with ...
[ "Remove", "NAs", "from", "dataframe", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L133-L150
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.remove_outlier
def remove_outlier(self, data, sd_val): """ Remove outliers from dataframe. Note ---- 1. This function excludes all lines with NA in all columns. Parameters ---------- data : pd.DataFrame() Dataframe to remove outliers from. sd_val : int ...
python
def remove_outlier(self, data, sd_val): """ Remove outliers from dataframe. Note ---- 1. This function excludes all lines with NA in all columns. Parameters ---------- data : pd.DataFrame() Dataframe to remove outliers from. sd_val : int ...
[ "def", "remove_outlier", "(", "self", ",", "data", ",", "sd_val", ")", ":", "data", "=", "data", ".", "dropna", "(", ")", "data", "=", "data", "[", "(", "np", ".", "abs", "(", "stats", ".", "zscore", "(", "data", ")", ")", "<", "float", "(", "s...
Remove outliers from dataframe. Note ---- 1. This function excludes all lines with NA in all columns. Parameters ---------- data : pd.DataFrame() Dataframe to remove outliers from. sd_val : int Standard Deviation Value (specifices how...
[ "Remove", "outliers", "from", "dataframe", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L153-L175
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.remove_out_of_bounds
def remove_out_of_bounds(self, data, low_bound, high_bound): """ Remove out of bound datapoints from dataframe. This function removes all points < low_bound and > high_bound. To Do, 1. Add a different boundary for each column. Parameters ---------- data ...
python
def remove_out_of_bounds(self, data, low_bound, high_bound): """ Remove out of bound datapoints from dataframe. This function removes all points < low_bound and > high_bound. To Do, 1. Add a different boundary for each column. Parameters ---------- data ...
[ "def", "remove_out_of_bounds", "(", "self", ",", "data", ",", "low_bound", ",", "high_bound", ")", ":", "data", "=", "data", ".", "dropna", "(", ")", "data", "=", "data", "[", "(", "data", ">", "low_bound", ")", ".", "all", "(", "axis", "=", "1", "...
Remove out of bound datapoints from dataframe. This function removes all points < low_bound and > high_bound. To Do, 1. Add a different boundary for each column. Parameters ---------- data : pd.DataFrame() Dataframe to remove bounds from. low...
[ "Remove", "out", "of", "bound", "datapoints", "from", "dataframe", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L178-L203
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data._set_TS_index
def _set_TS_index(self, data): """ Convert index to datetime and all other columns to numeric Parameters ---------- data : pd.DataFrame() Input dataframe. Returns ------- pd.DataFrame() Modified dataframe. """ ...
python
def _set_TS_index(self, data): """ Convert index to datetime and all other columns to numeric Parameters ---------- data : pd.DataFrame() Input dataframe. Returns ------- pd.DataFrame() Modified dataframe. """ ...
[ "def", "_set_TS_index", "(", "self", ",", "data", ")", ":", "# Set index", "data", ".", "index", "=", "pd", ".", "to_datetime", "(", "data", ".", "index", ",", "error", "=", "\"ignore\"", ")", "# Format types to numeric", "for", "col", "in", "data", ".", ...
Convert index to datetime and all other columns to numeric Parameters ---------- data : pd.DataFrame() Input dataframe. Returns ------- pd.DataFrame() Modified dataframe.
[ "Convert", "index", "to", "datetime", "and", "all", "other", "columns", "to", "numeric" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L283-L305
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data._utc_to_local
def _utc_to_local(self, data, local_zone="America/Los_Angeles"): """ Adjust index of dataframe according to timezone that is requested by user. Parameters ---------- data : pd.DataFrame() Pandas dataframe of json timeseries response from server. local_zone :...
python
def _utc_to_local(self, data, local_zone="America/Los_Angeles"): """ Adjust index of dataframe according to timezone that is requested by user. Parameters ---------- data : pd.DataFrame() Pandas dataframe of json timeseries response from server. local_zone :...
[ "def", "_utc_to_local", "(", "self", ",", "data", ",", "local_zone", "=", "\"America/Los_Angeles\"", ")", ":", "# Accounts for localtime shift", "data", ".", "index", "=", "data", ".", "index", ".", "tz_localize", "(", "pytz", ".", "utc", ")", ".", "tz_convert...
Adjust index of dataframe according to timezone that is requested by user. Parameters ---------- data : pd.DataFrame() Pandas dataframe of json timeseries response from server. local_zone : str pytz.timezone string of specified local timezone to change i...
[ "Adjust", "index", "of", "dataframe", "according", "to", "timezone", "that", "is", "requested", "by", "user", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L308-L331
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data._local_to_utc
def _local_to_utc(self, timestamp, local_zone="America/Los_Angeles"): """ Convert local timestamp to UTC. Parameters ---------- timestamp : pd.DataFrame() Input Pandas dataframe whose index needs to be changed. local_zone : str Name of local zone. Defa...
python
def _local_to_utc(self, timestamp, local_zone="America/Los_Angeles"): """ Convert local timestamp to UTC. Parameters ---------- timestamp : pd.DataFrame() Input Pandas dataframe whose index needs to be changed. local_zone : str Name of local zone. Defa...
[ "def", "_local_to_utc", "(", "self", ",", "timestamp", ",", "local_zone", "=", "\"America/Los_Angeles\"", ")", ":", "timestamp_new", "=", "pd", ".", "to_datetime", "(", "timestamp", ",", "infer_datetime_format", "=", "True", ",", "errors", "=", "'coerce'", ")", ...
Convert local timestamp to UTC. Parameters ---------- timestamp : pd.DataFrame() Input Pandas dataframe whose index needs to be changed. local_zone : str Name of local zone. Defaults to PST. Returns ------- pd.DataFrame() D...
[ "Convert", "local", "timestamp", "to", "UTC", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L334-L354
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.remove_start_NaN
def remove_start_NaN(self, data, var=None): """ Remove start NaN. CHECK: Note issue with multi-column df. Parameters ---------- data : pd.DataFrame() Input dataframe. var : list(str) List that specifies specific columns of ...
python
def remove_start_NaN(self, data, var=None): """ Remove start NaN. CHECK: Note issue with multi-column df. Parameters ---------- data : pd.DataFrame() Input dataframe. var : list(str) List that specifies specific columns of ...
[ "def", "remove_start_NaN", "(", "self", ",", "data", ",", "var", "=", "None", ")", ":", "# Limit to one or some variables", "if", "var", ":", "start_ok_data", "=", "data", "[", "var", "]", ".", "first_valid_index", "(", ")", "else", ":", "start_ok_data", "="...
Remove start NaN. CHECK: Note issue with multi-column df. Parameters ---------- data : pd.DataFrame() Input dataframe. var : list(str) List that specifies specific columns of dataframe. Returns ------- pd.D...
[ "Remove", "start", "NaN", ".", "CHECK", ":", "Note", "issue", "with", "multi", "-", "column", "df", ".", "Parameters", "----------", "data", ":", "pd", ".", "DataFrame", "()", "Input", "dataframe", ".", "var", ":", "list", "(", "str", ")", "List", "tha...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L357-L383
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.remove_end_NaN
def remove_end_NaN(self, data, var=None): """ Remove end NaN. CHECK: Note issue with multi-column df. Parameters ---------- data : pd.DataFrame() Input dataframe. var : list(str) List that specifies specific columns of data...
python
def remove_end_NaN(self, data, var=None): """ Remove end NaN. CHECK: Note issue with multi-column df. Parameters ---------- data : pd.DataFrame() Input dataframe. var : list(str) List that specifies specific columns of data...
[ "def", "remove_end_NaN", "(", "self", ",", "data", ",", "var", "=", "None", ")", ":", "# Limit to one or some variables", "if", "var", ":", "end_ok_data", "=", "data", "[", "var", "]", ".", "last_valid_index", "(", ")", "else", ":", "end_ok_data", "=", "da...
Remove end NaN. CHECK: Note issue with multi-column df. Parameters ---------- data : pd.DataFrame() Input dataframe. var : list(str) List that specifies specific columns of dataframe. Returns ------- pd.Dat...
[ "Remove", "end", "NaN", ".", "CHECK", ":", "Note", "issue", "with", "multi", "-", "column", "df", ".", "Parameters", "----------", "data", ":", "pd", ".", "DataFrame", "()", "Input", "dataframe", ".", "var", ":", "list", "(", "str", ")", "List", "that"...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L386-L412
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data._find_missing
def _find_missing(self, data, return_bool=False): """ ??? Parameters ---------- data : pd.DataFrame() Input dataframe. return_bool : bool ??? Returns ------- pd.DataFrame() ??? """ # Th...
python
def _find_missing(self, data, return_bool=False): """ ??? Parameters ---------- data : pd.DataFrame() Input dataframe. return_bool : bool ??? Returns ------- pd.DataFrame() ??? """ # Th...
[ "def", "_find_missing", "(", "self", ",", "data", ",", "return_bool", "=", "False", ")", ":", "# This returns the full table with True where the condition is true", "if", "return_bool", "==", "False", ":", "data", "=", "self", ".", "_find_missing_return_frame", "(", "...
??? Parameters ---------- data : pd.DataFrame() Input dataframe. return_bool : bool ??? Returns ------- pd.DataFrame() ???
[ "???" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L432-L465
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.display_missing
def display_missing(self, data, return_bool="any"): """ ??? Parameters ---------- data : pd.DataFrame() Input dataframe. return_bool : bool ??? Returns ------- pd.DataFrame() ??? """ ...
python
def display_missing(self, data, return_bool="any"): """ ??? Parameters ---------- data : pd.DataFrame() Input dataframe. return_bool : bool ??? Returns ------- pd.DataFrame() ??? """ ...
[ "def", "display_missing", "(", "self", ",", "data", ",", "return_bool", "=", "\"any\"", ")", ":", "if", "return_bool", "==", "\"any\"", ":", "bool_sel", "=", "self", ".", "_find_missing", "(", "data", ",", "return_bool", "=", "\"any\"", ")", "elif", "retur...
??? Parameters ---------- data : pd.DataFrame() Input dataframe. return_bool : bool ??? Returns ------- pd.DataFrame() ???
[ "???", "Parameters", "----------", "data", ":", "pd", ".", "DataFrame", "()", "Input", "dataframe", ".", "return_bool", ":", "bool", "???" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L468-L491
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.count_missing
def count_missing(self, data, output="number"): """ ??? Parameters ---------- data : pd.DataFrame() Input dataframe. output : str Sting indicating the output of function (number or percent) Returns ------- int/float ...
python
def count_missing(self, data, output="number"): """ ??? Parameters ---------- data : pd.DataFrame() Input dataframe. output : str Sting indicating the output of function (number or percent) Returns ------- int/float ...
[ "def", "count_missing", "(", "self", ",", "data", ",", "output", "=", "\"number\"", ")", ":", "count", "=", "self", ".", "_find_missing", "(", "data", ",", "return_bool", "=", "False", ")", ".", "sum", "(", ")", "if", "output", "==", "\"number\"", ":",...
??? Parameters ---------- data : pd.DataFrame() Input dataframe. output : str Sting indicating the output of function (number or percent) Returns ------- int/float Count of missing data (int or float)
[ "???", "Parameters", "----------", "data", ":", "pd", ".", "DataFrame", "()", "Input", "dataframe", ".", "output", ":", "str", "Sting", "indicating", "the", "output", "of", "function", "(", "number", "or", "percent", ")" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L494-L516
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.remove_missing
def remove_missing(self, data, return_bool="any"): """ ??? Parameters ---------- data : pd.DataFrame() Input dataframe. return_bool : bool ??? Returns ------- pd.DataFrame() ??? """ ...
python
def remove_missing(self, data, return_bool="any"): """ ??? Parameters ---------- data : pd.DataFrame() Input dataframe. return_bool : bool ??? Returns ------- pd.DataFrame() ??? """ ...
[ "def", "remove_missing", "(", "self", ",", "data", ",", "return_bool", "=", "\"any\"", ")", ":", "if", "return_bool", "==", "\"any\"", ":", "bool_sel", "=", "self", ".", "_find_missing", "(", "data", ",", "return_bool", "=", "\"any\"", ")", "elif", "return...
??? Parameters ---------- data : pd.DataFrame() Input dataframe. return_bool : bool ??? Returns ------- pd.DataFrame() ???
[ "???", "Parameters", "----------", "data", ":", "pd", ".", "DataFrame", "()", "Input", "dataframe", ".", "return_bool", ":", "bool", "???" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L519-L541
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data._find_outOfBound
def _find_outOfBound(self, data, lowBound, highBound): """ Mask for selecting data that is out of bounds. Parameters ---------- data : pd.DataFrame() Input dataframe. lowBound : float Lower bound for dataframe. highBound : flo...
python
def _find_outOfBound(self, data, lowBound, highBound): """ Mask for selecting data that is out of bounds. Parameters ---------- data : pd.DataFrame() Input dataframe. lowBound : float Lower bound for dataframe. highBound : flo...
[ "def", "_find_outOfBound", "(", "self", ",", "data", ",", "lowBound", ",", "highBound", ")", ":", "data", "=", "(", "(", "data", "<", "lowBound", ")", "|", "(", "data", ">", "highBound", ")", ")", "return", "data" ]
Mask for selecting data that is out of bounds. Parameters ---------- data : pd.DataFrame() Input dataframe. lowBound : float Lower bound for dataframe. highBound : float Higher bound for dataframe. Returns ...
[ "Mask", "for", "selecting", "data", "that", "is", "out", "of", "bounds", ".", "Parameters", "----------", "data", ":", "pd", ".", "DataFrame", "()", "Input", "dataframe", ".", "lowBound", ":", "float", "Lower", "bound", "for", "dataframe", ".", "highBound", ...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L544-L563
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.display_outOfBound
def display_outOfBound(self, data, lowBound, highBound): """ Select data that is out of bounds. Parameters ---------- data : pd.DataFrame() Input dataframe. lowBound : float Lower bound for dataframe. highBound : float ...
python
def display_outOfBound(self, data, lowBound, highBound): """ Select data that is out of bounds. Parameters ---------- data : pd.DataFrame() Input dataframe. lowBound : float Lower bound for dataframe. highBound : float ...
[ "def", "display_outOfBound", "(", "self", ",", "data", ",", "lowBound", ",", "highBound", ")", ":", "data", "=", "data", "[", "self", ".", "_find_outOfBound", "(", "data", ",", "lowBound", ",", "highBound", ")", ".", "any", "(", "axis", "=", "1", ")", ...
Select data that is out of bounds. Parameters ---------- data : pd.DataFrame() Input dataframe. lowBound : float Lower bound for dataframe. highBound : float Higher bound for dataframe. Returns ------- ...
[ "Select", "data", "that", "is", "out", "of", "bounds", ".", "Parameters", "----------", "data", ":", "pd", ".", "DataFrame", "()", "Input", "dataframe", ".", "lowBound", ":", "float", "Lower", "bound", "for", "dataframe", ".", "highBound", ":", "float", "H...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L566-L586
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.count_outOfBound
def count_outOfBound(self, data, lowBound, highBound, output): """ Count the number of out of bounds data. Parameters ---------- data : pd.DataFrame() Input dataframe. lowBound : float Lower bound for dataframe. highBound : float ...
python
def count_outOfBound(self, data, lowBound, highBound, output): """ Count the number of out of bounds data. Parameters ---------- data : pd.DataFrame() Input dataframe. lowBound : float Lower bound for dataframe. highBound : float ...
[ "def", "count_outOfBound", "(", "self", ",", "data", ",", "lowBound", ",", "highBound", ",", "output", ")", ":", "count", "=", "self", ".", "_find_outOfBound", "(", "data", ",", "lowBound", ",", "highBound", ")", ".", "sum", "(", ")", "if", "output", "...
Count the number of out of bounds data. Parameters ---------- data : pd.DataFrame() Input dataframe. lowBound : float Lower bound for dataframe. highBound : float Higher bound for dataframe. output : str ...
[ "Count", "the", "number", "of", "out", "of", "bounds", "data", ".", "Parameters", "----------", "data", ":", "pd", ".", "DataFrame", "()", "Input", "dataframe", ".", "lowBound", ":", "float", "Lower", "bound", "for", "dataframe", ".", "highBound", ":", "fl...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L589-L615
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.remove_outOfBound
def remove_outOfBound(self, data, lowBound, highBound): """ Remove out of bounds data from input dataframe. Parameters ---------- data : pd.DataFrame() Input dataframe. lowBound : float Lower bound for dataframe. highBound : float ...
python
def remove_outOfBound(self, data, lowBound, highBound): """ Remove out of bounds data from input dataframe. Parameters ---------- data : pd.DataFrame() Input dataframe. lowBound : float Lower bound for dataframe. highBound : float ...
[ "def", "remove_outOfBound", "(", "self", ",", "data", ",", "lowBound", ",", "highBound", ")", ":", "data", "=", "data", "[", "~", "self", ".", "_find_outOfBound", "(", "data", ",", "lowBound", ",", "highBound", ")", ".", "any", "(", "axis", "=", "1", ...
Remove out of bounds data from input dataframe. Parameters ---------- data : pd.DataFrame() Input dataframe. lowBound : float Lower bound for dataframe. highBound : float Higher bound for dataframe. Returns ---...
[ "Remove", "out", "of", "bounds", "data", "from", "input", "dataframe", ".", "Parameters", "----------", "data", ":", "pd", ".", "DataFrame", "()", "Input", "dataframe", ".", "lowBound", ":", "float", "Lower", "bound", "for", "dataframe", ".", "highBound", ":...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L618-L638
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data._calc_outliers_bounds
def _calc_outliers_bounds(self, data, method, coeff, window): """ Calculate the lower and higher bound for outlier detection. Parameters ---------- data : pd.DataFrame() Input dataframe. method : str Method to use for calculating the...
python
def _calc_outliers_bounds(self, data, method, coeff, window): """ Calculate the lower and higher bound for outlier detection. Parameters ---------- data : pd.DataFrame() Input dataframe. method : str Method to use for calculating the...
[ "def", "_calc_outliers_bounds", "(", "self", ",", "data", ",", "method", ",", "coeff", ",", "window", ")", ":", "if", "method", "==", "\"std\"", ":", "lowBound", "=", "(", "data", ".", "mean", "(", "axis", "=", "0", ")", "-", "coeff", "*", "data", ...
Calculate the lower and higher bound for outlier detection. Parameters ---------- data : pd.DataFrame() Input dataframe. method : str Method to use for calculating the lower and higher bounds. coeff : int Coefficien...
[ "Calculate", "the", "lower", "and", "higher", "bound", "for", "outlier", "detection", ".", "Parameters", "----------", "data", ":", "pd", ".", "DataFrame", "()", "Input", "dataframe", ".", "method", ":", "str", "Method", "to", "use", "for", "calculating", "t...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L641-L698
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.display_outliers
def display_outliers(self, data, method, coeff, window=10): """ Returns dataframe with outliers. Parameters ---------- data : pd.DataFrame() Input dataframe. method : str Method to use for calculating the lower and higher bounds. ...
python
def display_outliers(self, data, method, coeff, window=10): """ Returns dataframe with outliers. Parameters ---------- data : pd.DataFrame() Input dataframe. method : str Method to use for calculating the lower and higher bounds. ...
[ "def", "display_outliers", "(", "self", ",", "data", ",", "method", ",", "coeff", ",", "window", "=", "10", ")", ":", "lowBound", ",", "highBound", "=", "self", ".", "_calc_outliers_bounds", "(", "data", ",", "method", ",", "coeff", ",", "window", ")", ...
Returns dataframe with outliers. Parameters ---------- data : pd.DataFrame() Input dataframe. method : str Method to use for calculating the lower and higher bounds. coeff : int Coefficient to use in calculation. ...
[ "Returns", "dataframe", "with", "outliers", ".", "Parameters", "----------", "data", ":", "pd", ".", "DataFrame", "()", "Input", "dataframe", ".", "method", ":", "str", "Method", "to", "use", "for", "calculating", "the", "lower", "and", "higher", "bounds", "...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L701-L724
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.count_outliers
def count_outliers(self, data, method, coeff, output, window=10): """ Count the number of outliers in dataframe. Parameters ---------- data : pd.DataFrame() Input dataframe. method : str Method to use for calculating the lower and high...
python
def count_outliers(self, data, method, coeff, output, window=10): """ Count the number of outliers in dataframe. Parameters ---------- data : pd.DataFrame() Input dataframe. method : str Method to use for calculating the lower and high...
[ "def", "count_outliers", "(", "self", ",", "data", ",", "method", ",", "coeff", ",", "output", ",", "window", "=", "10", ")", ":", "lowBound", ",", "highBound", "=", "self", ".", "_calc_outliers_bounds", "(", "data", ",", "method", ",", "coeff", ",", "...
Count the number of outliers in dataframe. Parameters ---------- data : pd.DataFrame() Input dataframe. method : str Method to use for calculating the lower and higher bounds. coeff : int Coefficient to use in calcula...
[ "Count", "the", "number", "of", "outliers", "in", "dataframe", ".", "Parameters", "----------", "data", ":", "pd", ".", "DataFrame", "()", "Input", "dataframe", ".", "method", ":", "str", "Method", "to", "use", "for", "calculating", "the", "lower", "and", ...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L727-L752
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.remove_outliers
def remove_outliers(self, data, method, coeff, window=10): """ Remove the outliers in dataframe. Parameters ---------- data : pd.DataFrame() Input dataframe. method : str Method to use for calculating the lower and higher bounds. ...
python
def remove_outliers(self, data, method, coeff, window=10): """ Remove the outliers in dataframe. Parameters ---------- data : pd.DataFrame() Input dataframe. method : str Method to use for calculating the lower and higher bounds. ...
[ "def", "remove_outliers", "(", "self", ",", "data", ",", "method", ",", "coeff", ",", "window", "=", "10", ")", ":", "lowBound", ",", "highBound", "=", "self", ".", "_calc_outliers_bounds", "(", "data", ",", "method", ",", "coeff", ",", "window", ")", ...
Remove the outliers in dataframe. Parameters ---------- data : pd.DataFrame() Input dataframe. method : str Method to use for calculating the lower and higher bounds. coeff : int Coefficient to use in calculation. ...
[ "Remove", "the", "outliers", "in", "dataframe", ".", "Parameters", "----------", "data", ":", "pd", ".", "DataFrame", "()", "Input", "dataframe", ".", "method", ":", "str", "Method", "to", "use", "for", "calculating", "the", "lower", "and", "higher", "bounds...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L755-L778
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.count_if
def count_if(self, data, condition, val, output="number"): """ Count the number of values that match the condition. Parameters ---------- data : pd.DataFrame() Input dataframe. condition : str Condition to match. val : flo...
python
def count_if(self, data, condition, val, output="number"): """ Count the number of values that match the condition. Parameters ---------- data : pd.DataFrame() Input dataframe. condition : str Condition to match. val : flo...
[ "def", "count_if", "(", "self", ",", "data", ",", "condition", ",", "val", ",", "output", "=", "\"number\"", ")", ":", "if", "condition", "==", "\"=\"", ":", "count", "=", "self", ".", "_find_equal_to_values", "(", "data", ",", "val", ")", ".", "sum", ...
Count the number of values that match the condition. Parameters ---------- data : pd.DataFrame() Input dataframe. condition : str Condition to match. val : float Value to compare against. output : str ...
[ "Count", "the", "number", "of", "values", "that", "match", "the", "condition", ".", "Parameters", "----------", "data", ":", "pd", ".", "DataFrame", "()", "Input", "dataframe", ".", "condition", ":", "str", "Condition", "to", "match", ".", "val", ":", "flo...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L907-L946
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.find_uuid
def find_uuid(self, obj, column_name): """ Find uuid. Parameters ---------- obj : ??? the object returned by the MDAL Query column_name : str input point returned from MDAL Query Returns ------- str th...
python
def find_uuid(self, obj, column_name): """ Find uuid. Parameters ---------- obj : ??? the object returned by the MDAL Query column_name : str input point returned from MDAL Query Returns ------- str th...
[ "def", "find_uuid", "(", "self", ",", "obj", ",", "column_name", ")", ":", "keys", "=", "obj", ".", "context", ".", "keys", "(", ")", "for", "i", "in", "keys", ":", "if", "column_name", "in", "obj", ".", "context", "[", "i", "]", "[", "'?point'", ...
Find uuid. Parameters ---------- obj : ??? the object returned by the MDAL Query column_name : str input point returned from MDAL Query Returns ------- str the uuid that correlates with the data
[ "Find", "uuid", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L952-L975
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.identify_missing
def identify_missing(self, df, check_start=True): """ Identify missing data. Parameters ---------- df : pd.DataFrame() Dataframe to check for missing data. check_start : bool turns 0 to 1 for the first observation, to display the start of...
python
def identify_missing(self, df, check_start=True): """ Identify missing data. Parameters ---------- df : pd.DataFrame() Dataframe to check for missing data. check_start : bool turns 0 to 1 for the first observation, to display the start of...
[ "def", "identify_missing", "(", "self", ",", "df", ",", "check_start", "=", "True", ")", ":", "# Check start changes the first value of df to 1, when the data stream is initially missing", "# This allows the diff function to acknowledge the missing data", "data_missing", "=", "df", ...
Identify missing data. Parameters ---------- df : pd.DataFrame() Dataframe to check for missing data. check_start : bool turns 0 to 1 for the first observation, to display the start of the data as the beginning of the missing data event ...
[ "Identify", "missing", "data", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L978-L1006
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.diff_boolean
def diff_boolean(self, df, column_name=None, uuid=None, duration=True, min_event_filter='3 hours'): """ takes the dataframe of missing values, and returns a dataframe that indicates the length of each event where data was continuously missing Parameters ---------- df ...
python
def diff_boolean(self, df, column_name=None, uuid=None, duration=True, min_event_filter='3 hours'): """ takes the dataframe of missing values, and returns a dataframe that indicates the length of each event where data was continuously missing Parameters ---------- df ...
[ "def", "diff_boolean", "(", "self", ",", "df", ",", "column_name", "=", "None", ",", "uuid", "=", "None", ",", "duration", "=", "True", ",", "min_event_filter", "=", "'3 hours'", ")", ":", "if", "uuid", "==", "None", ":", "uuid", "=", "'End'", "data_ga...
takes the dataframe of missing values, and returns a dataframe that indicates the length of each event where data was continuously missing Parameters ---------- df : pd.DataFrame() Dataframe to check for missing data (must be in boolean format where 1 indic...
[ "takes", "the", "dataframe", "of", "missing", "values", "and", "returns", "a", "dataframe", "that", "indicates", "the", "length", "of", "each", "event", "where", "data", "was", "continuously", "missing" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L1009-L1050
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.analyze_quality_table
def analyze_quality_table(self, obj,low_bound=None, high_bound=None): """ Takes in an the object returned by the MDAL query, and analyzes the quality of the data for each column in the df. Returns a df of data quality metrics To Do ----- Need to make it specific for varying met...
python
def analyze_quality_table(self, obj,low_bound=None, high_bound=None): """ Takes in an the object returned by the MDAL query, and analyzes the quality of the data for each column in the df. Returns a df of data quality metrics To Do ----- Need to make it specific for varying met...
[ "def", "analyze_quality_table", "(", "self", ",", "obj", ",", "low_bound", "=", "None", ",", "high_bound", "=", "None", ")", ":", "data", "=", "obj", ".", "df", "N_rows", "=", "3", "N_cols", "=", "data", ".", "shape", "[", "1", "]", "d", "=", "pd",...
Takes in an the object returned by the MDAL query, and analyzes the quality of the data for each column in the df. Returns a df of data quality metrics To Do ----- Need to make it specific for varying meters and label it for each type, Either separate functions or make the func...
[ "Takes", "in", "an", "the", "object", "returned", "by", "the", "MDAL", "query", "and", "analyzes", "the", "quality", "of", "the", "data", "for", "each", "column", "in", "the", "df", ".", "Returns", "a", "df", "of", "data", "quality", "metrics" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L1053-L1108
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.analyze_quality_graph
def analyze_quality_graph(self, obj): """ Takes in an the object returned by the MDAL query, and analyzes the quality of the data for each column in the df in the form of graphs. The Graphs returned show missing data events over time, and missing data frequency during each hour of the d...
python
def analyze_quality_graph(self, obj): """ Takes in an the object returned by the MDAL query, and analyzes the quality of the data for each column in the df in the form of graphs. The Graphs returned show missing data events over time, and missing data frequency during each hour of the d...
[ "def", "analyze_quality_graph", "(", "self", ",", "obj", ")", ":", "data", "=", "obj", ".", "df", "for", "i", "in", "range", "(", "data", ".", "shape", "[", "1", "]", ")", ":", "data_per_meter", "=", "data", ".", "iloc", "[", ":", ",", "[", "i", ...
Takes in an the object returned by the MDAL query, and analyzes the quality of the data for each column in the df in the form of graphs. The Graphs returned show missing data events over time, and missing data frequency during each hour of the day To Do ----- Need to ma...
[ "Takes", "in", "an", "the", "object", "returned", "by", "the", "MDAL", "query", "and", "analyzes", "the", "quality", "of", "the", "data", "for", "each", "column", "in", "the", "df", "in", "the", "form", "of", "graphs", ".", "The", "Graphs", "returned", ...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L1111-L1147
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
Clean_Data.event_duration
def event_duration(self, obj, dictionary, low_bound=None, high_bound=None): """ Takes in an object and returns a dictionary with the missing data events (start and end) for each column in the inputted object (will map to a uuid) To Do ----- Need to make it specific for varying m...
python
def event_duration(self, obj, dictionary, low_bound=None, high_bound=None): """ Takes in an object and returns a dictionary with the missing data events (start and end) for each column in the inputted object (will map to a uuid) To Do ----- Need to make it specific for varying m...
[ "def", "event_duration", "(", "self", ",", "obj", ",", "dictionary", ",", "low_bound", "=", "None", ",", "high_bound", "=", "None", ")", ":", "data", "=", "obj", ".", "df", "N_cols", "=", "data", ".", "shape", "[", "1", "]", "if", "low_bound", ":", ...
Takes in an object and returns a dictionary with the missing data events (start and end) for each column in the inputted object (will map to a uuid) To Do ----- Need to make it specific for varying meters and label it for each type, Either separate functions or make the function...
[ "Takes", "in", "an", "object", "and", "returns", "a", "dictionary", "with", "the", "missing", "data", "events", "(", "start", "and", "end", ")", "for", "each", "column", "in", "the", "inputted", "object", "(", "will", "map", "to", "a", "uuid", ")" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L1151-L1199
SoftwareDefinedBuildings/XBOS
models/ciee/thermal_model.py
execute_schedule
def execute_schedule(day, sched, popt, initial_temperature): """ sched is a list of (hsp, csp) setpoints at 30m intervals """ output = [] actions = [] prev_temp = initial_temperature weather = predict_weather(day) print len(sched), len(weather) for idx, epoch in enumerate(sched): ...
python
def execute_schedule(day, sched, popt, initial_temperature): """ sched is a list of (hsp, csp) setpoints at 30m intervals """ output = [] actions = [] prev_temp = initial_temperature weather = predict_weather(day) print len(sched), len(weather) for idx, epoch in enumerate(sched): ...
[ "def", "execute_schedule", "(", "day", ",", "sched", ",", "popt", ",", "initial_temperature", ")", ":", "output", "=", "[", "]", "actions", "=", "[", "]", "prev_temp", "=", "initial_temperature", "weather", "=", "predict_weather", "(", "day", ")", "print", ...
sched is a list of (hsp, csp) setpoints at 30m intervals
[ "sched", "is", "a", "list", "of", "(", "hsp", "csp", ")", "setpoints", "at", "30m", "intervals" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/models/ciee/thermal_model.py#L72-L95
SoftwareDefinedBuildings/XBOS
apps/data_analysis/XBOS_data_analytics/Clean_Data.py
Clean_Data.clean_data
def clean_data(self, resample=True, freq='h', resampler='mean', interpolate=True, limit=1, method='linear', remove_na=True, remove_na_how='any', remove_outliers=True, sd_val=3, remove_out_of_bounds=True, low_bound=0, high_bound=9998): ...
python
def clean_data(self, resample=True, freq='h', resampler='mean', interpolate=True, limit=1, method='linear', remove_na=True, remove_na_how='any', remove_outliers=True, sd_val=3, remove_out_of_bounds=True, low_bound=0, high_bound=9998): ...
[ "def", "clean_data", "(", "self", ",", "resample", "=", "True", ",", "freq", "=", "'h'", ",", "resampler", "=", "'mean'", ",", "interpolate", "=", "True", ",", "limit", "=", "1", ",", "method", "=", "'linear'", ",", "remove_na", "=", "True", ",", "re...
Clean dataframe. Parameters ---------- resample : bool Indicates whether to resample data or not. freq : str Resampling frequency i.e. d, h, 15T... resampler : str Resampling type i.e. mean, max....
[ "Clean", "dataframe", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/data_analysis/XBOS_data_analytics/Clean_Data.py#L198-L269
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Wrapper.py
Wrapper.get_global_count
def get_global_count(self): """ Return global count (used for naming of .json and .png files) Returns ------- int Global count """ # Check current number of json files in results directory and dump current json in new file path_to_json = se...
python
def get_global_count(self): """ Return global count (used for naming of .json and .png files) Returns ------- int Global count """ # Check current number of json files in results directory and dump current json in new file path_to_json = se...
[ "def", "get_global_count", "(", "self", ")", ":", "# Check current number of json files in results directory and dump current json in new file", "path_to_json", "=", "self", ".", "results_folder_name", "+", "'/'", "json_files", "=", "[", "pos_json", "for", "pos_json", "in", ...
Return global count (used for naming of .json and .png files) Returns ------- int Global count
[ "Return", "global", "count", "(", "used", "for", "naming", "of", ".", "json", "and", ".", "png", "files", ")" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Wrapper.py#L114-L128
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Wrapper.py
Wrapper.write_json
def write_json(self): """ Dump data into json file. """ with open(self.results_folder_name + '/results-' + str(self.get_global_count()) + '.json', 'a') as f: json.dump(self.result, f)
python
def write_json(self): """ Dump data into json file. """ with open(self.results_folder_name + '/results-' + str(self.get_global_count()) + '.json', 'a') as f: json.dump(self.result, f)
[ "def", "write_json", "(", "self", ")", ":", "with", "open", "(", "self", ".", "results_folder_name", "+", "'/results-'", "+", "str", "(", "self", ".", "get_global_count", "(", ")", ")", "+", "'.json'", ",", "'a'", ")", "as", "f", ":", "json", ".", "d...
Dump data into json file.
[ "Dump", "data", "into", "json", "file", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Wrapper.py#L143-L147
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Wrapper.py
Wrapper.site_analysis
def site_analysis(self, folder_name, site_install_mapping, end_date): """ Summarize site data into a single table. folder_name : str Folder where all site data resides. site_event_mapping : dic Dictionary of site name to date of installation. end_date ...
python
def site_analysis(self, folder_name, site_install_mapping, end_date): """ Summarize site data into a single table. folder_name : str Folder where all site data resides. site_event_mapping : dic Dictionary of site name to date of installation. end_date ...
[ "def", "site_analysis", "(", "self", ",", "folder_name", ",", "site_install_mapping", ",", "end_date", ")", ":", "def", "count_number_of_days", "(", "site", ",", "end_date", ")", ":", "\"\"\" Counts the number of days between two dates.\n\n Parameters\n ...
Summarize site data into a single table. folder_name : str Folder where all site data resides. site_event_mapping : dic Dictionary of site name to date of installation. end_date : str End date of data collected.
[ "Summarize", "site", "data", "into", "a", "single", "table", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Wrapper.py#L150-L235
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Wrapper.py
Wrapper.read_json
def read_json(self, file_name=None, input_json=None, imported_data=pd.DataFrame()): """ Read input json file. Notes ----- The input json file should include ALL parameters. Parameters ---------- file_name : str Filename to be read. input_js...
python
def read_json(self, file_name=None, input_json=None, imported_data=pd.DataFrame()): """ Read input json file. Notes ----- The input json file should include ALL parameters. Parameters ---------- file_name : str Filename to be read. input_js...
[ "def", "read_json", "(", "self", ",", "file_name", "=", "None", ",", "input_json", "=", "None", ",", "imported_data", "=", "pd", ".", "DataFrame", "(", ")", ")", ":", "if", "not", "file_name", "and", "not", "input_json", "or", "file_name", "and", "input_...
Read input json file. Notes ----- The input json file should include ALL parameters. Parameters ---------- file_name : str Filename to be read. input_json : dict JSON object to be read. imported_data : pd.DataFrame() ...
[ "Read", "input", "json", "file", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Wrapper.py#L238-L298
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Wrapper.py
Wrapper.search
def search(self, file_name, imported_data=None): """ Run models on different data configurations. Note ---- The input json file should include ALL parameters. Parameters ---------- file_name : str Optional json file to read parameters. ...
python
def search(self, file_name, imported_data=None): """ Run models on different data configurations. Note ---- The input json file should include ALL parameters. Parameters ---------- file_name : str Optional json file to read parameters. ...
[ "def", "search", "(", "self", ",", "file_name", ",", "imported_data", "=", "None", ")", ":", "resample_freq", "=", "[", "'15T'", ",", "'h'", ",", "'d'", "]", "time_freq", "=", "{", "'year'", ":", "[", "True", ",", "False", ",", "False", ",", "False",...
Run models on different data configurations. Note ---- The input json file should include ALL parameters. Parameters ---------- file_name : str Optional json file to read parameters. imported_data : pd.DataFrame() Pandas Dataframe...
[ "Run", "models", "on", "different", "data", "configurations", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Wrapper.py#L302-L373
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Wrapper.py
Wrapper.import_data
def import_data(self, file_name='*', folder_name='.', head_row=0, index_col=0, convert_col=True, concat_files=False, save_file=True): """ Imports csv file(s) and stores the result in self.imported_data. Note ---- 1. If folder exists out of current directo...
python
def import_data(self, file_name='*', folder_name='.', head_row=0, index_col=0, convert_col=True, concat_files=False, save_file=True): """ Imports csv file(s) and stores the result in self.imported_data. Note ---- 1. If folder exists out of current directo...
[ "def", "import_data", "(", "self", ",", "file_name", "=", "'*'", ",", "folder_name", "=", "'.'", ",", "head_row", "=", "0", ",", "index_col", "=", "0", ",", "convert_col", "=", "True", ",", "concat_files", "=", "False", ",", "save_file", "=", "True", "...
Imports csv file(s) and stores the result in self.imported_data. Note ---- 1. If folder exists out of current directory, folder_name should contain correct regex 2. Assuming there's no file called "\*.csv" Parameters ---------- file_name : str ...
[ "Imports", "csv", "file", "(", "s", ")", "and", "stores", "the", "result", "in", "self", ".", "imported_data", ".", "Note", "----", "1", ".", "If", "folder", "exists", "out", "of", "current", "directory", "folder_name", "should", "contain", "correct", "reg...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Wrapper.py#L376-L436
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Wrapper.py
Wrapper.clean_data
def clean_data(self, data, rename_col=None, drop_col=None, resample=True, freq='h', resampler='mean', interpolate=True, limit=1, method='linear', remove_na=True, remove_na_how='any', remove_outliers=True, sd_val=3, remov...
python
def clean_data(self, data, rename_col=None, drop_col=None, resample=True, freq='h', resampler='mean', interpolate=True, limit=1, method='linear', remove_na=True, remove_na_how='any', remove_outliers=True, sd_val=3, remov...
[ "def", "clean_data", "(", "self", ",", "data", ",", "rename_col", "=", "None", ",", "drop_col", "=", "None", ",", "resample", "=", "True", ",", "freq", "=", "'h'", ",", "resampler", "=", "'mean'", ",", "interpolate", "=", "True", ",", "limit", "=", "...
Cleans dataframe according to user specifications and stores result in self.cleaned_data. Parameters ---------- data : pd.DataFrame() Dataframe to be cleaned. rename_col : list(str) List of new column names. drop_col ...
[ "Cleans", "dataframe", "according", "to", "user", "specifications", "and", "stores", "result", "in", "self", ".", "cleaned_data", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Wrapper.py#L439-L543
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Wrapper.py
Wrapper.uncertainity_equation
def uncertainity_equation(self, model_data_obj, E_measured, E_predicted, confidence_level): """ model_data_obj : Model_Data() An instance of Model_Data() which is a user defined class. E_measured : pd.Series() Actual values of energy in the post-retrofit per...
python
def uncertainity_equation(self, model_data_obj, E_measured, E_predicted, confidence_level): """ model_data_obj : Model_Data() An instance of Model_Data() which is a user defined class. E_measured : pd.Series() Actual values of energy in the post-retrofit per...
[ "def", "uncertainity_equation", "(", "self", ",", "model_data_obj", ",", "E_measured", ",", "E_predicted", ",", "confidence_level", ")", ":", "# Number of rows in baseline period", "n", "=", "model_data_obj", ".", "baseline_in", ".", "shape", "[", "0", "]", "# Numbe...
model_data_obj : Model_Data() An instance of Model_Data() which is a user defined class. E_measured : pd.Series() Actual values of energy in the post-retrofit period. E_predicted : pd.Series() Predicted values of energy in the post-retrofit perio...
[ "model_data_obj", ":", "Model_Data", "()", "An", "instance", "of", "Model_Data", "()", "which", "is", "a", "user", "defined", "class", ".", "E_measured", ":", "pd", ".", "Series", "()", "Actual", "values", "of", "energy", "in", "the", "post", "-", "retrofi...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Wrapper.py#L754-L801
SoftwareDefinedBuildings/XBOS
python/xbos/services/mdal.py
MDALClient.do_query
def do_query(self, query, timeout=DEFAULT_TIMEOUT, tz=pytz.timezone("US/Pacific")): """ Query structure is as follows: query = { # We bind UUIDs found as the result of a Brick query to a variable name # that we can use later. # Each variable definition has th...
python
def do_query(self, query, timeout=DEFAULT_TIMEOUT, tz=pytz.timezone("US/Pacific")): """ Query structure is as follows: query = { # We bind UUIDs found as the result of a Brick query to a variable name # that we can use later. # Each variable definition has th...
[ "def", "do_query", "(", "self", ",", "query", ",", "timeout", "=", "DEFAULT_TIMEOUT", ",", "tz", "=", "pytz", ".", "timezone", "(", "\"US/Pacific\"", ")", ")", ":", "nonce", "=", "str", "(", "random", ".", "randint", "(", "0", ",", "2", "**", "32", ...
Query structure is as follows: query = { # We bind UUIDs found as the result of a Brick query to a variable name # that we can use later. # Each variable definition has the following: # - name: how we will refer to this group of UUIDs # - definition...
[ "Query", "structure", "is", "as", "follows", ":" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/python/xbos/services/mdal.py#L64-L167
SoftwareDefinedBuildings/XBOS
dashboards/sitedash/occupancy.py
get_occupancy
def get_occupancy(last, bucketsize): """ We deliver historical occupancy up until "now". If the building has occupancy sensors, we pull that data and aggregate it by zone. Take mean occupancy per zone (across all sensors). If building does *not* have occupancy sensors, then we need to read the results...
python
def get_occupancy(last, bucketsize): """ We deliver historical occupancy up until "now". If the building has occupancy sensors, we pull that data and aggregate it by zone. Take mean occupancy per zone (across all sensors). If building does *not* have occupancy sensors, then we need to read the results...
[ "def", "get_occupancy", "(", "last", ",", "bucketsize", ")", ":", "if", "last", "not", "in", "[", "'hour'", ",", "'day'", ",", "'week'", "]", ":", "return", "\"Must be hour, day, week\"", "start_date", "=", "get_start", "(", "last", ")", "zones", "=", "def...
We deliver historical occupancy up until "now". If the building has occupancy sensors, we pull that data and aggregate it by zone. Take mean occupancy per zone (across all sensors). If building does *not* have occupancy sensors, then we need to read the results from some occupancy file.
[ "We", "deliver", "historical", "occupancy", "up", "until", "now", ".", "If", "the", "building", "has", "occupancy", "sensors", "we", "pull", "that", "data", "and", "aggregate", "it", "by", "zone", ".", "Take", "mean", "occupancy", "per", "zone", "(", "acro...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/dashboards/sitedash/occupancy.py#L41-L110
SoftwareDefinedBuildings/XBOS
apps/prediction_service_framework/prediction_service.py
run_service
def run_service(prediction_fxn, namespace, prediction_type, block=False): """ Supported prediction_type: - hvac - occupancy """ subscribe = '{0}/s.predictions/+/i.{1}/slot/request'.format(namespace, prediction_type) if block: print 'Blocking is True! This will loop forever and progra...
python
def run_service(prediction_fxn, namespace, prediction_type, block=False): """ Supported prediction_type: - hvac - occupancy """ subscribe = '{0}/s.predictions/+/i.{1}/slot/request'.format(namespace, prediction_type) if block: print 'Blocking is True! This will loop forever and progra...
[ "def", "run_service", "(", "prediction_fxn", ",", "namespace", ",", "prediction_type", ",", "block", "=", "False", ")", ":", "subscribe", "=", "'{0}/s.predictions/+/i.{1}/slot/request'", ".", "format", "(", "namespace", ",", "prediction_type", ")", "if", "block", ...
Supported prediction_type: - hvac - occupancy
[ "Supported", "prediction_type", ":", "-", "hvac", "-", "occupancy" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/prediction_service_framework/prediction_service.py#L13-L49
SoftwareDefinedBuildings/XBOS
dashboards/sitedash/app.py
prevmonday
def prevmonday(num): """ Return unix SECOND timestamp of "num" mondays ago """ today = get_today() lastmonday = today - timedelta(days=today.weekday(), weeks=num) return lastmonday
python
def prevmonday(num): """ Return unix SECOND timestamp of "num" mondays ago """ today = get_today() lastmonday = today - timedelta(days=today.weekday(), weeks=num) return lastmonday
[ "def", "prevmonday", "(", "num", ")", ":", "today", "=", "get_today", "(", ")", "lastmonday", "=", "today", "-", "timedelta", "(", "days", "=", "today", ".", "weekday", "(", ")", ",", "weeks", "=", "num", ")", "return", "lastmonday" ]
Return unix SECOND timestamp of "num" mondays ago
[ "Return", "unix", "SECOND", "timestamp", "of", "num", "mondays", "ago" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/dashboards/sitedash/app.py#L74-L80
SoftwareDefinedBuildings/XBOS
apps/consumption/iec.py
med_filt
def med_filt(x, k=201): """Apply a length-k median filter to a 1D array x. Boundaries are extended by repeating endpoints. """ if x.ndim > 1: x = np.squeeze(x) med = np.median(x) assert k % 2 == 1, "Median filter length must be odd." assert x.ndim == 1, "Input must be one-dimensional...
python
def med_filt(x, k=201): """Apply a length-k median filter to a 1D array x. Boundaries are extended by repeating endpoints. """ if x.ndim > 1: x = np.squeeze(x) med = np.median(x) assert k % 2 == 1, "Median filter length must be odd." assert x.ndim == 1, "Input must be one-dimensional...
[ "def", "med_filt", "(", "x", ",", "k", "=", "201", ")", ":", "if", "x", ".", "ndim", ">", "1", ":", "x", "=", "np", ".", "squeeze", "(", "x", ")", "med", "=", "np", ".", "median", "(", "x", ")", "assert", "k", "%", "2", "==", "1", ",", ...
Apply a length-k median filter to a 1D array x. Boundaries are extended by repeating endpoints.
[ "Apply", "a", "length", "-", "k", "median", "filter", "to", "a", "1D", "array", "x", ".", "Boundaries", "are", "extended", "by", "repeating", "endpoints", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/consumption/iec.py#L114-L132
SoftwareDefinedBuildings/XBOS
apps/occupancy/OccupancyThanos.py
find_similar_days
def find_similar_days(training_data, now, observation_length, k, method=hamming_distance): min_time = training_data.index[0] + timedelta(minutes=observation_length) # Find moments in our dataset that have the same hour/minute and is_weekend() == weekend. selector = ((training_data.index.minute == now.minute) & ...
python
def find_similar_days(training_data, now, observation_length, k, method=hamming_distance): min_time = training_data.index[0] + timedelta(minutes=observation_length) # Find moments in our dataset that have the same hour/minute and is_weekend() == weekend. selector = ((training_data.index.minute == now.minute) & ...
[ "def", "find_similar_days", "(", "training_data", ",", "now", ",", "observation_length", ",", "k", ",", "method", "=", "hamming_distance", ")", ":", "min_time", "=", "training_data", ".", "index", "[", "0", "]", "+", "timedelta", "(", "minutes", "=", "observ...
if now.weekday() < 5: selector = ( (training_data.index.minute == now.minute) & (training_data.index.hour == now.hour) & (training_data.index > min_time) & (training_data.index.weekday < 5) ) else: selector = ( (training_data.index.minute == now.minute) & (training_data.index.hour == now.hour) ...
[ "if", "now", ".", "weekday", "()", "<", "5", ":", "selector", "=", "(", "(", "training_data", ".", "index", ".", "minute", "==", "now", ".", "minute", ")", "&", "(", "training_data", ".", "index", ".", "hour", "==", "now", ".", "hour", ")", "&", ...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/occupancy/OccupancyThanos.py#L48-L88
SoftwareDefinedBuildings/XBOS
apps/data_analysis/XBOS_data_analytics/Wrapper.py
Wrapper.preprocess_data
def preprocess_data(self, data, hdh_cpoint=65, cdh_cpoint=65, col_hdh_cdh=None, col_degree=None, degree=None, standardize=False, normalize=False, year=False, month=False, week=False, tod=False, dow=False, ...
python
def preprocess_data(self, data, hdh_cpoint=65, cdh_cpoint=65, col_hdh_cdh=None, col_degree=None, degree=None, standardize=False, normalize=False, year=False, month=False, week=False, tod=False, dow=False, ...
[ "def", "preprocess_data", "(", "self", ",", "data", ",", "hdh_cpoint", "=", "65", ",", "cdh_cpoint", "=", "65", ",", "col_hdh_cdh", "=", "None", ",", "col_degree", "=", "None", ",", "degree", "=", "None", ",", "standardize", "=", "False", ",", "normalize...
Preprocesses dataframe according to user specifications and stores result in self.preprocessed_data. Parameters ---------- data : pd.DataFrame() Dataframe to be preprocessed. hdh_cpoint : int Heating degree hours. Defaults to 65. cdh_cpoin...
[ "Preprocesses", "dataframe", "according", "to", "user", "specifications", "and", "stores", "result", "in", "self", ".", "preprocessed_data", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/data_analysis/XBOS_data_analytics/Wrapper.py#L544-L634
SoftwareDefinedBuildings/XBOS
apps/data_analysis/XBOS_data_analytics/Wrapper.py
Wrapper.model
def model(self, data, ind_col=None, dep_col=None, project_ind_col=None, baseline_period=[None, None], projection_period=None, exclude_time_period=None, alphas=np.logspace(-4,1,30), cv=3, plot=True, figsize=None, custom_model_func=None): """...
python
def model(self, data, ind_col=None, dep_col=None, project_ind_col=None, baseline_period=[None, None], projection_period=None, exclude_time_period=None, alphas=np.logspace(-4,1,30), cv=3, plot=True, figsize=None, custom_model_func=None): """...
[ "def", "model", "(", "self", ",", "data", ",", "ind_col", "=", "None", ",", "dep_col", "=", "None", ",", "project_ind_col", "=", "None", ",", "baseline_period", "=", "[", "None", ",", "None", "]", ",", "projection_period", "=", "None", ",", "exclude_time...
Split data into baseline and projection periods, run models on them and display metrics & plots. Parameters ---------- data : pd.DataFrame() Dataframe to model. ind_col : list(str) Independent column(s) of dataframe. Defaults to...
[ "Split", "data", "into", "baseline", "and", "projection", "periods", "run", "models", "on", "them", "and", "display", "metrics", "&", "plots", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/data_analysis/XBOS_data_analytics/Wrapper.py#L637-L749
SoftwareDefinedBuildings/XBOS
python/xbos/services/pundat.py
make_dataframe
def make_dataframe(result): """ Turns the results of one of the data API calls into a pandas dataframe """ import pandas as pd ret = {} if isinstance(result,dict): if 'timeseries' in result: result = result['timeseries'] for uuid, data in result.items(): df = pd.D...
python
def make_dataframe(result): """ Turns the results of one of the data API calls into a pandas dataframe """ import pandas as pd ret = {} if isinstance(result,dict): if 'timeseries' in result: result = result['timeseries'] for uuid, data in result.items(): df = pd.D...
[ "def", "make_dataframe", "(", "result", ")", ":", "import", "pandas", "as", "pd", "ret", "=", "{", "}", "if", "isinstance", "(", "result", ",", "dict", ")", ":", "if", "'timeseries'", "in", "result", ":", "result", "=", "result", "[", "'timeseries'", "...
Turns the results of one of the data API calls into a pandas dataframe
[ "Turns", "the", "results", "of", "one", "of", "the", "data", "API", "calls", "into", "a", "pandas", "dataframe" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/python/xbos/services/pundat.py#L247-L265
SoftwareDefinedBuildings/XBOS
python/xbos/services/pundat.py
merge_dfs
def merge_dfs(dfs, resample=None, do_mean=False, do_sum=False, do_min=False, do_max=False): """ dfs is a dictionary of key => dataframe This method resamples each of the dataframes if a period is provided (http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases) """ if len(dfs...
python
def merge_dfs(dfs, resample=None, do_mean=False, do_sum=False, do_min=False, do_max=False): """ dfs is a dictionary of key => dataframe This method resamples each of the dataframes if a period is provided (http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases) """ if len(dfs...
[ "def", "merge_dfs", "(", "dfs", ",", "resample", "=", "None", ",", "do_mean", "=", "False", ",", "do_sum", "=", "False", ",", "do_min", "=", "False", ",", "do_max", "=", "False", ")", ":", "if", "len", "(", "dfs", ")", "==", "0", ":", "raise", "E...
dfs is a dictionary of key => dataframe This method resamples each of the dataframes if a period is provided (http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases)
[ "dfs", "is", "a", "dictionary", "of", "key", "=", ">", "dataframe", "This", "method", "resamples", "each", "of", "the", "dataframes", "if", "a", "period", "is", "provided", "(", "http", ":", "//", "pandas", ".", "pydata", ".", "org", "/", "pandas", "-"...
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/python/xbos/services/pundat.py#L267-L296
SoftwareDefinedBuildings/XBOS
python/xbos/services/pundat.py
DataClient.query
def query(self, query, archiver="", timeout=DEFAULT_TIMEOUT): """ Runs the given pundat query and returns the results as a Python object. Arguments: [query]: the query string [archiver]: if specified, this is the archiver to use. Else, it will run on the first archiver passed ...
python
def query(self, query, archiver="", timeout=DEFAULT_TIMEOUT): """ Runs the given pundat query and returns the results as a Python object. Arguments: [query]: the query string [archiver]: if specified, this is the archiver to use. Else, it will run on the first archiver passed ...
[ "def", "query", "(", "self", ",", "query", ",", "archiver", "=", "\"\"", ",", "timeout", "=", "DEFAULT_TIMEOUT", ")", ":", "if", "archiver", "==", "\"\"", ":", "archiver", "=", "self", ".", "archivers", "[", "0", "]", "nonce", "=", "random", ".", "ra...
Runs the given pundat query and returns the results as a Python object. Arguments: [query]: the query string [archiver]: if specified, this is the archiver to use. Else, it will run on the first archiver passed into the constructor for the client [timeout]: time in s...
[ "Runs", "the", "given", "pundat", "query", "and", "returns", "the", "results", "as", "a", "Python", "object", "." ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/python/xbos/services/pundat.py#L61-L111
SoftwareDefinedBuildings/XBOS
python/xbos/services/pundat.py
DataClient.uuids
def uuids(self, where, archiver="", timeout=DEFAULT_TIMEOUT): """ Using the given where-clause, finds all UUIDs that match Arguments: [where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED Main"') [archiver]: if specified, this is the archiver to use. Else, it wi...
python
def uuids(self, where, archiver="", timeout=DEFAULT_TIMEOUT): """ Using the given where-clause, finds all UUIDs that match Arguments: [where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED Main"') [archiver]: if specified, this is the archiver to use. Else, it wi...
[ "def", "uuids", "(", "self", ",", "where", ",", "archiver", "=", "\"\"", ",", "timeout", "=", "DEFAULT_TIMEOUT", ")", ":", "resp", "=", "self", ".", "query", "(", "\"select uuid where {0}\"", ".", "format", "(", "where", ")", ",", "archiver", ",", "timeo...
Using the given where-clause, finds all UUIDs that match Arguments: [where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED Main"') [archiver]: if specified, this is the archiver to use. Else, it will run on the first archiver passed into the constructor for t...
[ "Using", "the", "given", "where", "-", "clause", "finds", "all", "UUIDs", "that", "match" ]
train
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/python/xbos/services/pundat.py#L113-L127