Skip to content

Instantly share code, notes, and snippets.

View pranjalAI's full-sized avatar

Pranjal Saxena pranjalAI

View GitHub Profile
Total_transactions = len(data)
normal = len(data[data.Class == 0])
fraudulent = len(data[data.Class == 1])
fraud_percentage = round(fraudulent/normal*100, 2)
print(cl('Total number of Trnsactions are {}'.format(Total_transactions), attrs = ['bold']))
print(cl('Number of Normal Transactions are {}'.format(normal), attrs = ['bold']))
print(cl('Number of fraudulent Transactions are {}'.format(fraudulent), attrs = ['bold']))
print(cl('Percentage of fraud Transactions is {}'.format(fraud_percentage), attrs = ['bold']))
from collections import Counter
mylst = [1,1,1,2,2,2,2,3,3,3,3,3,4,4,5,6,6,6]
print(Counter(mylst))
Numbers = [30, 32, 14, 26, 18, 18, 20, 30, 28]
print("Original= ", Numbers)
Numbers = list(set(Numbers))
print("After removing duplicate= ", Numbers)
arr1 = ['T', 'r', 'i', 'c', 'k', 's']
res = "".join(arr1)
print (res)
i = 50
j = 100
temp = i
i = j
j = temp
print('The value of i after swapping: {}'.format(i))
print('The value of j after swapping: {}'.format(j))
i = 50
j = 100
i, j = j, i
print("i =", i)
print("j =", j)
import sys
mylst = ['India', 'Paris', 'London', 'Italy', 'Rome']
print("size of list = ",sys.getsizeof(mylst))
text = "Learning python"[::-1]
print(text)
matrix=[(1,2,3),(4,5,6),(7,8,9),(10,11,12)]
t_matrix = zip(*matrix)
for row in t_matrix:
print(row)
str ="Python"
print(str * 4)