Quick-Sort
title: "Quick Sorting"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
def quicksort(arr):
if len(arr) <= 1:
return arr
pivot = arr[len(arr) // 2]
left = [x for x in arr if x < pivot]
middle = [x for x in arr if x == pivot]
right = [x for x …
Read More
Random-Binary
title: "Random Binary"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
MAX = 10
for x in range(MAX):
val = random.randint(0, 1)
print(val)
Score: 0
Read More
Random-Max
title: "Random Max"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
MAX = 8
for x in range(MAX):
val = random.randint(14, 30)
print(val)
Score: 0
Read More
Random-Numbers
title: "Random Numbers"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
def get_random():
return rd.randint(0, 100)
def get_random_year_duration():
return round(rd.uniform(1,2), 1)
get_random_year_duration()
def get_random_price():
return round(rd.uniform(1, 100), 2)
Read More
Random Timestamp
title: "Random Timestamp"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
from random import randrange
import datetime
def random_date(start,l):
current = start
while l >= 0:
curr = current + datetime.timedelta(minutes=randrange(60))
yield curr
l-=1
def get_random_timestamp(max):
startDate = datetime.datetime(2013, 9, 20,13 …
Read More
Range With Even Numbers
title: "Range with Even Numbers"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
for x in range(0, 10, 2):
print(x)
for x in range(0, 100, 10):
print(x)
0
10
20
30
40
50
60
70
80
90
Score …
Read More
Read-Github-Csv
title: "Read GitHub CSV"
author: "Raja CSP Raman"
date: 2020-09-05
description: "-"
type: technical_note
draft: false
from io import BytesIO
import requests
import pandas as pd
FILEPATH = 'https://raw.githubusercontent.com/rajacsp/public-dataset/master/zynicide-wine-reviews/winemag-data-130k-v2.csv'
r = requests.get(FILEPATH)
data = r.content
onlinedata = BytesIO(data)
df = pd.read_csv(onlinedata …
Read More
Read-Gitlab-Csv
title: "Read GitLab CSV"
author: "Raja CSP Raman"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
from io import BytesIO
import requests
import pandas as pd
filename = 'https://gitlab.com/rajacsp/datasets/raw/master/FEELI%20SONG%20LIST%20-%20Songs.csv'
r = requests.get(filename)
data = r.content
onlinedata = BytesIO(data)
Read More
Read-Google-Csv
title: "Read Google CSV"
author: "Raja CSP Raman"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
from io import BytesIO
import requests
import pandas as pd
filename = 'https://docs.google.com/spreadsheet/ccc?key=1EfyD7A4YcdAzTfUO0t3yQ0HawetVF5pefS5pPyGVX4g&output=csv'
r = requests.get(filename)
data = r.content
df = pd.read_csv(BytesIO(data), index_col=0 …
Read More
Read-Google-Csv-With-Date
title: "Read Google CSV with Date"
author: "Raja CSP Raman"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
from io import BytesIO
import requests
import pandas as pd
filename = 'https://docs.google.com/spreadsheet/ccc?key=0Ak1ecr7i0wotdGJmTURJRnZLYlV3M2daNTRubTdwTXc&output=csv'
r = requests.get(filename)
data = r.content
df = pd.read_csv(BytesIO(data …
Read More