If you don't know what Wireguard is, well, you should. It's fast, easy to setup and highly configurable. We will configure Wireguard for multiple users with various restrictions using iptables.
This should fit most setups (not mine though 😉)
# Specify the stock that you want to analyze. | |
stock = 'TSLA' | |
# Request for data from Finhub.io (30 calls per second limit: https://finnhub.io/docs/api/rate-limit). | |
r = requests.get('https://finnhub.io/api/v1/stock/insider-transactions?symbol='+stock+'&token=YOUR API KEY') | |
# Load the JSON file as a string. | |
test = json.loads(r.text) |
import pandas as pd | |
df = pd.read_csv('/kaggle/input/bluebook-for-bulldozers/TrainAndValid.csv', parse_dates=['saledate'], low_memory=False) | |
from sklearn.model_selection import train_test_split | |
# Let's say we want to split the data in 80:10:10 for train:valid:test dataset | |
train_size=0.8 | |
X = df.drop(columns = ['SalePrice']).copy() |
import numpy as np | |
import PIL | |
from io import BytesIO | |
import matplotlib.pyplot as plt | |
def plt_to_text(plt_fig=None,width=144,vscale=0.96,colorful=True,invert=False,crop=False,outfile=None): | |
"""Displays matplotlib figure in terminal as text. You should use a monospcae font like `Cascadia Code PL` to display image correctly. Use before plt.show(). | |
- **Parameters** | |
- plt_fig: Matplotlib's figure instance. Auto picks if not given. | |
- width : Character width in terminal, default is 144. Decrease font size when width increased. |
# Add imputed values as columns to the untouched dataset | |
iris_orig['MF_sepal_length'] = X_imputed[:, 0] | |
iris_orig['MF_petal_width'] = X_imputed[:, -1] | |
comparison_df = iris_orig[['sepal_length', 'MF_sepal_length', 'petal_width', 'MF_petal_width']] | |
# Calculate absolute errors | |
comparison_df['ABS_ERROR_sepal_length'] = np.abs(compaison_df['sepal_length'] - comparison_df['MF_sepal_length']) | |
comparison_df['ABS_ERROR_petal_width'] = np.abs(compaison_df['petal_width'] - comparison_df['MF_petal_width']) | |
# Show only rows where imputation was performed |
votes | scaled_prob | |
---|---|---|
64.02877697841728 | 0 | |
79.85611510791367 | 0 | |
93.52517985611513 | 0 | |
107.19006190396522 | 0.0 | |
120.14388489208633 | 0 | |
135.97122302158274 | 0 | |
151.07913669064752 | 0 | |
159.70386481512466 | 0.011627906976744207 | |
173.36038146227202 | 0.02906976744186074 |
import pandas as pd | |
from pandas_datareader import data, wb | |
import datetime | |
start = pd.to_datetime('2020-02-04') | |
end = pd.to_datetime('today') | |
tesla_df = data.DataReader('TSLA', 'yahoo', start , end) | |
tesla_df |
If you don't know what Wireguard is, well, you should. It's fast, easy to setup and highly configurable. We will configure Wireguard for multiple users with various restrictions using iptables.
This should fit most setups (not mine though 😉)
PROJECT='ai-analytics-solutions' | |
BUCKET='ai-analytics-solutions-kfpdemo' | |
REGION='us-central1' | |
from datetime import datetime | |
import apache_beam as beam | |
def parse_nlp_result(response): | |
return [ | |
# response, # entire string |
library(tidyverse) | |
set.seed(406) | |
df <- tibble(x = runif(3), y = runif(3), z = runif(3)) | |
df %>% rowwise() %>% mutate(m = min(c(x, y, z))) | |
df %>% mutate(m = pmin(x, y, z)) | |
df %>% mutate(m = pmap_dbl(list(x, y, z), min)) |