Skip to content

Instantly share code, notes, and snippets.

View aravinthsci's full-sized avatar
🎯
Focusing

Aravinth aravinthsci

🎯
Focusing
View GitHub Profile
@aravinthsci
aravinthsci / bounding_box.py
Created January 30, 2022 06:50
Draw Bounding Box in a image using OpenCV
import cv2
# read image
img = cv2.imread('Lenna.png')
# convert to grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
@aravinthsci
aravinthsci / list_methods.py
Created September 7, 2021 13:04
List Methods (Python)
# Append
""" Add single element to end of List"""
fruits = ["Apple", "Orange", "Banana"]
fruits.append("Mango")
# Clear
""" Remove all Items from List"""
fruits = ["Apple", "Orange", "Banana"]
fruits.clear()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def readTable(tableName: String): DataFrame = {
val df = spark
.read
.format("delta")
.load("/opt/partitioned_lake/" + tableName)
df
}
import org.apache.spark.sql.delta.DeltaLog
import io.delta.tables._
import org.apache.spark.sql.functions._
import org.apache.spark.sql.{SaveMode, SparkSession, DataFrame}
def createPartitionedTable(data: DataFrame, tableName: String, Keys: String): Unit = {
data
.write
.partitionBy(Keys)
.format("delta")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.