This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Numbers = [30, 32, 14, 26, 18, 18, 20, 30, 28] | |
print("Original= ", Numbers) | |
Numbers = list(set(Numbers)) | |
print("After removing duplicate= ", Numbers) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arr1 = ['T', 'r', 'i', 'c', 'k', 's'] | |
res = "".join(arr1) | |
print (res) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i = 50 | |
j = 100 | |
i, j = j, i | |
print("i =", i) | |
print("j =", j) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
mylst = ['India', 'Paris', 'London', 'Italy', 'Rome'] | |
print("size of list = ",sys.getsizeof(mylst)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
text = "Learning python"[::-1] | |
print(text) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
matrix=[(1,2,3),(4,5,6),(7,8,9),(10,11,12)] | |
t_matrix = zip(*matrix) | |
for row in t_matrix: | |
print(row) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
str ="Python" | |
print(str * 4) |