def encode(encoding, obj): keys = obj._internal.key_array() if isinstance(keys, (vaex.strings.StringList32, vaex.strings.StringList64)): keys = vaex.strings.to_arrow(keys) keys = encoding.encode('array', keys) clsname = obj._internal.__class__.__name__ return { 'class': clsname, 'dtype': encoding.encode('dtype', vaex.dtype(obj.dtype)), 'data': { 'keys': keys, 'null_value': obj.null_value, 'nan_count': obj.nan_count, 'missing_count': obj.null_count, 'fingerprint': obj.fingerprint, } }
async def root(): with (HERE / 'index.html').open() as f: content = f.read() data = [] for name, ds in datasets.items(): data.append({ 'name': name, 'rows': ds.row_count, 'column': list(ds), 'schema': [{ 'name': k, 'type': str(vaex.dtype(v)) } for k, v in ds.schema().items()] }) content = content.replace( '// DATA', 'app.$data.datasets = %s\n app.$data.graphql = %s' % (json.dumps(data), json.dumps(vaex.settings.server.graphql))) return content
def __init__(self, ar, type): self.ar = ar # this should behave like a numpy array self.type = vaex.dtype(type)