Skip to content

Instantly share code, notes, and snippets.

View dipta007's full-sized avatar
🏠
Working from home

Shubhashis Roy Dipta dipta007

🏠
Working from home
View GitHub Profile
# Ugly Code
add_address(road, block, city, state, country)
# Clean Code
add_address(address: Address)
# Ugly code
def call(arr):
arr.append(1)
call(arr)
# Clean Code
def call(arr):
arr.append(1)
return arr
cnt += batch_size
if cnt >= total_row:
pds = get_all(files, chunksize=batch_size)
cnt = 0
def data_generator():
total_row = NUMBER_OF_ROWS
files = [
'a.csv',
'b.csv',
'c.csv',
'd.csv',
]
pds = get_all(files, chunksize=batch_size)
def merge_all(*args):
tmp = None
args = args[0]
for arg in args:
if tmp is None:
tmp = arg
else:
tmp = pd.merge(tmp, arg, how='inner', on=['id'])
return tmp
def get_all(*args, chunksize):
pds = []
args = args[0]
for arg in args:
pds.append(pd.read_csv(f'{BASE_PATH}/{arg}', chunksize=chunksize))
return pds
def get_all(*args, chunksize):
pds = []
args = args[0]
for arg in args:
pds.append(pd.read_csv(f'{BASE_PATH}/{arg}', chunksize=chunksize))
return pds
def merge_all(*args):
merged = None
args = args[0]
import csv
def data_generator():
with open('nlp.csv') as fp:
reader = csv.reader(fp)
for row in reader:
yield row
for row in data_generator():
print(row)
@dipta007
dipta007 / Music_genre_classification.ipynb
Last active April 12, 2022 09:07 — forked from parulnith/Music_genre_classification.ipynb
Music Genre Classification.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dipta007
dipta007 / hello-world-flask.py
Last active November 15, 2018 16:15
A simple hello world using Flask
from flask import Flask
app = Flask(__name__)
@app.route('/', methods=['GET'])
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run(debug=True)