This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
data = {'a': [1, 3, 4, 4], 'b': [1, 3, 2, 3]} | |
df = pd.DataFrame(data=data) | |
df.to_csv("data/old_data.csv") | |
data2 = {'a': [1, 3, 5, 4], 'b': [1, 3, 2, 3]} | |
df2 = pd.DataFrame(data=data2) | |
df2.to_csv("data/new_data.csv") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
protocol GQLNodeArgument {} | |
extension String: GQLNodeArgument {} | |
extension NSNumber: GQLNodeArgument {} | |
class GQLNode: StringLiteralConvertible, ArrayLiteralConvertible, Printable, DebugPrintable { | |
let name: String? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"reflect" | |
) | |
type Foo struct { | |
FirstName string `tag_name:"tag 1"` | |
LastName string `tag_name:"tag 2"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import HTTP | |
import File | |
import HTTPSClient | |
import JSON | |
var url: String? | |
do { | |
let client = try! Client(uri: "https://api.github.com:443") | |
var response = try client.get("/repos/vsouza/awesome-ios/git/trees/HEAD") | |
let buffer = try response.body.becomeBuffer() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spark_context = SparkContext(appName=kinesis_app_name) | |
spark_streaming_context = StreamingContext(spark_context, spark_batch_interval) | |
sql_context = SQLContext(spark_context) | |
kinesis_stream = KinesisUtils.createStream( | |
spark_streaming_context, kinesis_app_name, kinesis_stream, kinesis_endpoint, | |
aws_region, kinesis_initial_position, kinesis_checkpoint_interval) | |
py_rdd = kinesis_stream.map(lambda x: json.loads(x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spark_context.saveAsTextFile("s3n://parents/activity_log/01010101.txt") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def toRedshift(time, rdd): | |
try: | |
sqlContext = getSqlContextInstance(rdd.context) | |
schema = StructType([ | |
StructField('user_id', StringType(), True), | |
StructField('device_id', StringType(), True), | |
StructField('steps', IntegerType(), True), | |
StructField('battery_level', IntegerType(), True), | |
StructField('calories_spent', IntegerType(), True), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spark_streaming_context.start() | |
spark_streaming_context.awaitTermination() | |
spark_streaming_context.stop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
from pyspark import SparkContext | |
from pyspark.streaming import StreamingContext | |
from pyspark.streaming.kinesis import KinesisUtils, InitialPositionInStream | |
import datetime | |
import json | |
from pyspark.sql import SQLContext, Row | |
from pyspark.sql.types import * | |
aws_region = 'us-east-1' |
OlderNewer