Skip to content

Instantly share code, notes, and snippets.

View Eserthesay's full-sized avatar
🎯
Focusing

Eserthesay

🎯
Focusing
View GitHub Profile
from pptx import Presentation
from pptx.enum.shapes import MSO_SHAPE
from pptx.dml.color import RGBColor
from pptx.util import Inches, Pt
from pptx.enum.dml import MSO_THEME_COLOR
title='Automated Presentation Creating Process\n\
How to Create PowerPoint Presentations with Python '
pylogo='pylogo.png'
pptlogo='pptlogo.png'
from fpdf import FPDF
import os
import plotly.express as px
import plotly
df = px.data.iris()
pltx = px.scatter(df, x="sepal_width", y="sepal_length", color="species",
size='petal_length', hover_data=['petal_width'])
@Eserthesay
Eserthesay / auto_load.py
Last active January 30, 2023 15:29
Automated Data Import with Python
#setting current working directory as path
import pandas as pd
import os
from os import listdir
from os.path import isfile,join
import csv
file_path=os.getcwd()
data_path=file_path+'\\'+'data' # setting path for data folder
f_loop=[1,5,7,-10,12,14,-16]
pos=[]
neg=[]
for i in f_loop:
if i<0:
neg.append(i)
elif i>0:
pos.append(i)
list_ex1=[1,5,7,-10,12,14,-16,-8,0]
pos=[]
neg=[]
neg.append(list_ex1[0]) if list_ex1[0]<0 else pos.append(list_ex1[0])
neg.append(list_ex1[1]) if list_ex1[1]<0 else pos.append(list_ex1[1])
neg.append(list_ex1[2]) if list_ex1[2]<0 else pos.append(list_ex1[2])
neg.append(list_ex1[3]) if list_ex1[3]<0 else pos.append(list_ex1[3])
neg.append(list_ex1[4]) if list_ex1[4]<0 else pos.append(list_ex1[4])
from sklearn.datasets import make_regression
import matplotlib.pyplot as plt
%matplotlib inline
#generating random dataset for linear regression
x,y,coef=make_regression(n_samples=10,n_features=1,n_informative=1,n_targets=1,noise=
3,bias=1.0,coef=True,random_state=42)
#modelling
import pandas as pd
desc=open(r"abalone_names.txt")
print(desc.read())
df = pd.read_csv('https://query.data.world/s/is7jwu2tdgeqqxho53vrsq5bhjmf7d',header=None)
df.head()
columns=['Sex','Length','Diameter','Height','Whole weight','Shucked weight','Viscera weight','Shell weight','Rings']
df.columns=columns
import pandas as pd
movies_1=pd.DataFrame({'ID':[1,2,3,4,5,6],
'Movies': ['Breaking Bad','The Wire','Cosmos','The Sopranos','Chernobyl','Fargo'],
'Release Date':[2008,2002,1980,1999,2019,2014]})
movies_2=pd.DataFrame({'ID':[1,7,8,4,5,6],
'Movies':['Breaking Bad','Westworld','The Crown','The Sopranos','Chernobyl','Fargo'],
'IMDB Rating': [9.4,8.7,8.6,9.2,9.4,8.9] })
import requests
url = "https://community-open-weather-map.p.rapidapi.com/find"
querystring = {"type":"link%2C accurate","units":"metric","q":"istanbul"}
headers = {
'x-rapidapi-host': "community-open-weather-map.p.rapidapi.com",
'x-rapidapi-key': "{API KEY'inizi buraya girmelisiniz.}"
}
from forex_python.converter import CurrencyRates
c = CurrencyRates()
usd_rates=c.get_rates('USD')
usd=1.0
eur=usd_rates['EUR']
trl=usd_rates['TRY']
def capraz_kur_via_func(x,y,z):
return x/y*z