This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% https://www.swi-prolog.org/man/clpfd.html | |
:- use_module(library(clpfd)). | |
%% --- | |
%% Excerpted from "Seven Languages in Seven Weeks", | |
%% published by The Pragmatic Bookshelf. | |
%% Copyrights apply to this code. It may not be used to create training material, | |
%% courses, books, articles, and the like. Contact us if you are in doubt. | |
%% We make no guarantees that this code is fit for any purpose. | |
%% Visit http://www.pragmaticprogrammer.com/titles/btlang for more book information. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dask.bag as db | |
import json | |
json_bag = db.read_text('test.txt').map(json.loads) | |
dask_df = json_bag.to_dataframe() | |
print(dask_df.info()) | |
print(dask_df.head(3)) | |
pandas_df = dask_df.compute() | |
print(pandas_df.info()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
def parse_line(file_object): | |
while True: | |
line = file_object.readline() | |
if not line: | |
break | |
yield json.loads(line) | |
with open('test.txt', 'r') as file_reader: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% https://www.swi-prolog.org/man/clpfd.html | |
:- use_module(library(clpfd)). | |
%% --- | |
%% Excerpted from "Seven Languages in Seven Weeks", | |
%% published by The Pragmatic Bookshelf. | |
%% Copyrights apply to this code. It may not be used to create training material, | |
%% courses, books, articles, and the like. Contact us if you are in doubt. | |
%% We make no guarantees that this code is fit for any purpose. | |
%% Visit http://www.pragmaticprogrammer.com/titles/btlang for more book information. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from argparse import Namespace | |
import itertools | |
import os | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import torch.utils.data as data | |
import pytorch_lightning as pl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://gist.github.com/a-y-khan/69189c26df2dcbc8a252b02af897977d | |
# Super-simple example from Graphene tutorial | |
import graphene | |
from gql import gql, Client | |
class Query(graphene.ObjectType): | |
hello = graphene.String(argument=graphene.String(default_value='world')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import ijson | |
def test_ijson(filename): | |
record = {'records.item.author': None, | |
'records.item.author_flair_text': None, | |
'records.item.body': None} | |
parser = ijson.parse(open(filename, 'r')) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder