Tags » Python

My Decision: Saying 'Yes' to Python

Ok, I’m not exactly a newbie to coding. I took a course in C as a part of my undergrad degree, and have decent experience working with VB & R. 139 more words

Resampling Methods for Unbalanced Datasets - Fraudulent Transactions

Suppose you are tasked with developing a simple machine learning algorithm, whether supervised (with a clear target variable) or unsupervised (with no predefined outcome variable).  1,073 more words

Named tuple

from collections import namedtuple
import csv

nt = namedtuple(‘Numbers’,[‘a’,’b’,’c’])

numbers = nt(1,2,3)

print(‘Total: ‘,numbers.a + numbers.b + numbers.c)

days = namedtuple(‘days’,’Sunday Monday Tuesday Wednesday’)

print(days._fields) 59 more words

Python

Syntax error exception

try:

       employees = eval(input(‘Enter elements in list: ‘))

       print(employees)

except SyntaxError:

       print(‘Invalid syntax’)

Output

Enter elements in list: [4,5,6,7,8)
Invalid syntax

Python

Python localization

import locale
from datetime import *

loc = locale.setlocale(locale.LC_ALL,’us_US’)

print(‘USA: ‘,loc)

print(locale.currency(100,True))

dt=date.today()

print(dt.strftime(“%A, %d. %B %Y %I:%M%p”))

print()

loc = locale.setlocale(locale.LC_ALL,’uk_UK’)

print(‘UK:’,loc)

dt=date.today()

print(dt.strftime(“%A, %d. 94 more words

Python

Quandl and Python CoT report

This week I will show you how to extract the CoT report data to an excel using Python and Quandl.

Fist of all, you will need to sign up to Quandl. 134 more words

Educational