Skip to content

Instantly share code, notes, and snippets.

View pranjalAI's full-sized avatar

Pranjal Saxena pranjalAI

View GitHub Profile
from bokeh.plotting import figure, output_file, show
plot = figure(plot_width=300, plot_height=300)
plot.annulus(x=[1, 2, 3], y=[1, 2, 3], color="#7FC97F",
inner_radius=0.2, outer_radius=0.5)
show(plot)
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
dataset = sns.load_dataset("tips")
sns.relplot(
data=dataset,
x="total_bill", y="tip", col="time",
hue="smoker", style="smoker", size="size",
)
import plotly.graph_objects as go
fig = go.figure(data = go.bar(y=[1,2,3]))
fig.show()
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',
import pandas as pd
import missingno as msno
dataset = pd.read_csv('filename.csv')
msno.bar(dataset)
import yara
rule = yara.compile(source='rule foo: bar {strings: $a = "lmn" condition: $a}')
matches = rule.match(data='abcdefgjiklmnoprstuvwxyz')
html_doc = """
<html>
<head>
<title>Test Page</title>
</head>
<body>
<p><b>This is a test page.</b></p>
</body>
</html>
"""
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)
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()
#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