This file contains 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 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 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
#Packages related to general operating system & warnings | |
import os | |
import warnings | |
warnings.filterwarnings('ignore') | |
#Packages related to data importing, manipulation, exploratory data #analysis, data understanding | |
import numpy as np | |
import pandas as pd | |
from pandas import Series, DataFrame | |
from termcolor import colored as cl # text customization | |
#Packages related to data visualizaiton |
This file contains 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 mahotas | |
import mahotas.demos | |
import numpy as np | |
from pylab import imshow, gray, show | |
from os import path | |
photo = mahotas.demos.load('luispedro', as_grey=True) | |
photo = photo.astype(np.uint8) | |
gray() | |
imshow(photo) | |
show() |
This file contains 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
resp = ur.urlopen("https://thumbor.forbes.com/thumbor/960x0/https%3A%2F%2Fspecials-images.forbesimg.com%2Fdam%2Fimageserve%2F1068867780%2F960x0.jpg%3Ffit%3Dscale") | |
image = np.asarray(bytearray(resp.read()), dtype="uint8") | |
im = cv2.imdecode(image, cv2.IMREAD_COLOR) | |
blur = cv2.GaussianBlur(im, (5,5),0) | |
cv2_imshow(blur) |
This file contains 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
html_doc = """ | |
<html> | |
<head> | |
<title>Test Page</title> | |
</head> | |
<body> | |
<p><b>This is a test page.</b></p> | |
</body> | |
</html> | |
""" |
This file contains 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 yara | |
rule = yara.compile(source='rule foo: bar {strings: $a = "lmn" condition: $a}') | |
matches = rule.match(data='abcdefgjiklmnoprstuvwxyz') |
This file contains 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 pandas as pd | |
import missingno as msno | |
dataset = pd.read_csv('filename.csv') | |
msno.bar(dataset) |
This file contains 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 altair as alt | |
from vega_datasets import data | |
iris = data.iris() | |
# Making the Scatter Plot with altair | |
alt.Chart(iris).mark_point().encode( | |
# defining x-axis | |
x='sepalLength', | |
# defining y-axis | |
y='petalLength', |
This file contains 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 plotly.graph_objects as go | |
fig = go.figure(data = go.bar(y=[1,2,3])) | |
fig.show() |