Skip to content

Instantly share code, notes, and snippets.

View koushikmln's full-sized avatar

Koushik M.L.N koushikmln

View GitHub Profile
order_id = {}
for order_item in order_items[:20]:
if order_item.split(",")[1] in order_id:
order_id[order_item.split(",")[1]] = order_id[order_item.split(",")[1]] + float(order_item.split(",")[4])
else:
order_id[order_item.split(",")[1]] = float(order_item.split(",")[4])
print(order_id)
order_id = 4
total = 0;
for order_item in order_items[:20]:
if int(order_item.split(",")[1]) == order_id:
total = total + float(order_item.split(",")[4])
print(total)
@koushikmln
koushikmln / ML_Example.py
Created January 7, 2018 08:03
ML Example Using SKLearn
import numpy as np
import pandas as pd
import sklearn
from sklearn import tree
df = pd.read_csv("/data/input.csv")
texture_map = {"bumpy":0, "smooth":1}
df["texture"] = df["texture"].map(lambda x: texture_map[x])