Feeli-Song-Csv
title: "Feeli Song Collection"
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
Fibonacci
title: "Fibonacci"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
def fib(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fib(n-1) + fib(n-2)
Score: 5
Read More
Fibonacci-Generator
title: "Fibonacci in Generator"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
def fibonacci(n):
a = b = 1
for i in range(n):
yield a
a, b = b, a+b
for x in fibonacci(10):
print(x)
Read More
Fibonacci Lambda
title: "Fibonacci Lambda"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
def print_fibo(number):
print(list(map(lambda x, f = lambda x, f : (f(x-1,f) + f(x-2,f)) if x > 1 else 1: f(x,f), range(number))))
Read More
Find Python Location
title: "Find Python Location"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
/Users/rajacsp/anaconda3/bin/python
Score: 0
Read More
Function-Caching
title: "Function Caching"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
from functools import lru_cache
@lru_cache(maxsize=10)
def add(a, b):
print('add method called')
return a+b
Read More
Function With Return Type
title: "Function With Return Type"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
def square(a):
return a * a
def square(a:int) -> int:
return a * a
def square_1(a:int) -> str:
return a * a
Read More
Fuzzy-String-Ratio
title: "Fuzzy String Ratio"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
from fuzzywuzzy import fuzz
print(fuzz.ratio("this is a test", "this is a test!"))
print(fuzz.ratio("this is a cup", "this is a world cup"))
Score: 0
Read More
Generator-Expressions
title: "Generator Expressions Simple"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
result = [x for x in abc if(x > 6)]
square = [x*x for x in result]
Read More
Generator-Sample-1
# Example: Loop through a generator and print its values
def sample_generator():
for i in range(5): # Generates numbers 0 to 4
yield i
gen = sample_generator() # Create the generator
<generator object sample_generator at 0x7fe180371000>
for value in gen: # Loop through the generator
print(value)
Score …
Read More