Skip to content

Instantly share code, notes, and snippets.

View ostwalprasad's full-sized avatar

Prasad Ostwal ostwalprasad

View GitHub Profile
@ostwalprasad
ostwalprasad / 2D.py
Last active March 17, 2019 15:24
2D PLot
import plotly.graph_objs as go
import plotly
import pandas as pd
data = pd.read_csv("my_data.csv")
fig1 = go.Scatter(x=data['rpm'],
y=data['speed'],
mode='markers',
marker=dict(size=10,
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import pandas as pd
import plotly
import plotly.graph_objs as go
#Read cars data from csv
data = pd.read_csv("cars.csv")
import pandas as pd
data = pd.read_csv("cars.csv")
import plotly
import plotly.graph_objs as go
#Import modules
import plotly
import plotly.graph_objs as go
#Make Plotly figure
fig1 = go.Scatter(x=data['curb-weight'],
y=data['price'],
mode='markers')
#Make Plot.ly Layout
@ostwalprasad
ostwalprasad / cov.py
Created March 20, 2020 09:55
Covariance matrix only using NumPy
import numpy as np
import pandas as pd
df = YOUR_DATAFRAME
ones = np.ones([df_shape[0],df_shape[0]])
dev_mat = df - (ones @ df)/df_shape[0]
cov_mat = (dev_mat.T @ dev_mat) / df_shape[0]
#Songs
youtube-dl -f m4a --add-metadata https://www.youtube.com/watch?v=UDVtMYqUAyw
#Playlist
youtube-dl -f m4a --add-metadata --yes-playlist https://www.youtube.com/watch?v=UDVtMYqUAyw
@ostwalprasad
ostwalprasad / clear_pycache.bat
Created July 15, 2020 13:00
Clear __pycache__ folders and files from project folder
python -Bc "import pathlib; [p.unlink() for p in pathlib.Path('.').rglob('*.py[co]')]"
python -Bc "import pathlib; [p.rmdir() for p in pathlib.Path('.').rglob('__pycache__')]"