# Untitled

unknown
python
2 years ago
2.0 kB
4
Indexable
Never
```# 1. feladat
import datetime

szo = "egy"

# len = Length() szó hossza

def fuggveny(szo):
szohossz = len(szo)
kezdokarakter = int(len(szo)/2)
aktualis_nap = datetime.datetime.now().strftime("%A")

if szohossz%2 == 0:
return (szo[kezdokarakter:] + aktualis_nap)
else:
return (szo[kezdokarakter:] + "EDA")
print(fuggveny("bivalybasznádfelsőalsó"))

import pandas as pd
import matplotlib.pyplot as plt

df["timestamp_ok"] = pd.to_datetime(df["Timestamp"], format='%Y-%m-%d;%H:%M:%S')

plt.plot(df.timestamp_ok,df.Sensor1)

df["atlag"] = 0

filt1 = df.Sensor1 > df.Sensor1.mean()
filt2 = df.Sensor1 < df.Sensor1.mean()

df.atlag[filt1] = 1
df.atlag[filt2] = -1

import requests
import json

def koktel(drinkname): # definiálunk egy függvényt aminek zárójelben adunk egy változót
response = requests.get("https://www.thecocktaildb.com/api/json/v1/1/search.php?s=" + drinkname)
data = json.loads(response.text) #kiírjuk a beolvasott adatokat
for drink in data["drinks"]:
print(drink["strIngredient1"])
return len(data["drinks"])

koktel("margarita")

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

energy_desc = energy_df.describe()
energy_df.utc_timestamp.isna().sum()

energy_df.fillna(energy_df.mean(),inplace=True)

# boxplot
plt.boxplot([energy_df.iloc[:,1],energy_df.iloc[:,2]], labels = [energy_df.columns[1],energy_df.columns[2]])
energy_df.iloc[:,1:3].boxplot()
# energy_df.iloc[:,3],energy_df.iloc[:,4]]

#pairplot
plt.figure(figsize = (10,10))
sns.pairplot(energy_df.iloc[:,1:])
plt.savefig('pariplot_minta.png')

#correlation heatmap
corr_matr = energy_df.iloc[:,1:].corr()
sns.heatmap(energy_df.iloc[:,1:].corr())

```