Skip to content

Instantly share code, notes, and snippets.

We can't make this file beautiful and searchable because it's too large.
year_birth,education,marital_status,income,kidhome,teenhome,dt_customer,recency,mntwines,mntfruits,mntmeatproducts,mntfishproducts,mntsweetproducts,mntgoldprods,numdealspurchases,numwebpurchases,numcatalogpurchases,numstorepurchases,numwebvisitsmonth,mspent,mnt_products
-0.9826452427992796,Graduation,0.251914909444513,0.2981740629401377,-0.824408654452758,-0.9304208419016567,-1.6477157245205196,0.3072174777447595,0.97851215919596,1.5441139707635037,1.775555505156627,2.463137771551334,1.5048158706393295,0.8660755696028194,0.41225374163792716,1.5047864420312593,2.684417405339313,-0.5613335176489767,0.714912254704507,1.6844150810662528,1.6844150810662528
-1.2329416725689062,Graduation,0.251914909444513,-0.2642860407085032,1.0323901691019337,0.908090741696017,1.6049808060182085,-0.3838469826919725,-0.873171323884603,-0.637696936053221,-0.7354388252881704,-0.6521901129412602,-0.6363126502178857,-0.7368307708169055,-0.15731746262628182,-1.1670508268469268,-0.5928061136150217,-1.1806111403455897,-0.13291380142145673
@dsibi
dsibi / magicSquare.js
Created June 11, 2021 10:59
Реализовать скрипт, генерирующий магический квадрат. Входным значением скрипта должен быть размер квадратной матрицы. Скрипт должен возвращать квадратную матрицу, суммы чисел во всех вертикалях, горизонталях и диагоналях которой равны.
//Магический квадрат для нечетных чисел с проверкой
//создаем функцию для магического квадрата, аргументом который будет размер матрицы
function magicSquare(n) {
//создадим пустой массив данных, в который будем записывать числа и сохраним его в переменной `matrix`
let matrix = [];
//создадим переменную для позиции по горизонтали - `x`
let x = 0;
//создадим переменную для позиции по вертикали - `y`
let y = (n - 1) / 2;
//цикл для итерирования по строкам (для создания пустых массивов равных размеру квадрата)
@dsibi
dsibi / CAPTCHA.php
Created June 11, 2021 10:56
С использованием ImageMagick реализовать простейший генератор CAPTCHA, формирующий картинку со случайным набором 5 цифр.
$width = 100; //Ширина изображения
$height = 60; //Высота изображения
$font_size = 16; //Размер шрифта
$let_amount = 5; //Количество цифр, которые нужно набрать
$fon_let_amount = 30; //Количество цифр на фоне
$font = "fonts/cour.ttf"; //Путь к шрифту
//набор символов
$numbers = array(1,2,3,4,5,6,7,8,9,0);
//цвета
tooltip label x y
SKATING SKILLS Use of deep edges, steps and turns 0 20
SKATING SKILLS Balance, rhythmic knee action and precision of foot placement 20 30
SKATING SKILLS Flow and glide 30 40
SKATING SKILLS Varied use of power, speed and acceleration 40 50
SKATING SKILLS Use of multi directional skating 50 60
SKATING SKILLS Use of one foot skating 15 25
TRANSITIONS Continuity of movements from one element to another 20 30
TRANSITIONS Variety (including variety of holds in Ice Dance) 30 40
TRANSITIONS Difficulty 40 50
@dsibi
dsibi / data.csv
Created March 28, 2021 11:10
600 bce to 2012 there were more then 34 000 meteorite impacts
We can't make this file beautiful and searchable because it's too large.
place,year,mass_g,lon,lat,fell_found
Hoba,1920,60000000,17.91667,-19.58333,Found
Cape York,1818,58200000,-64.93333,76.13333,Found
Campo del Cielo,1576,50000000,-60.58333,-27.46667,Found
Canyon Diablo,1891,30000000,-111.03333,35.05,Found
Armanty,1898,28000000,88,47,Found
Gibeon,1836,26000000,18,-25.5,Found
Chupaderos,1852,24300000,-105.1,27,Found
Mundrabilla,1911,24000000,127.55,-30.78333,Found
#I have issue with wrong reflection data in hovers in the code below. See code with comments for each block.
import plotly.express as px
import pandas as pd
import plotly.graph_objects as go
rows=[['501-600','15','122.58333','45.36667','Name1'],
['till 500','4','12.5','27.5','Name2'],
['more 601','41','-115.53333','38.08','Name3'],
['till 500', '26', '65.5', '29.5','Name4'],
#In the code below I tried to use customdata to make hovertemplate, but in this case on visualization it shows only data from the first row everywhere. I believe there should be function, but don't know how to implement it.
import plotly.express as px
import plotly.graph_objs as go
import pandas as pd
rows=[['501-600','15','122.58333','45.36667','slategray'],
['till 500','4','12.5','27.5','teal'],
['more 1001','41','-115.53333','38.08','whitesmoke'],
]
@dsibi
dsibi / Hover.py
Last active June 2, 2020 12:49
Meteors
import plotly.graph_objs as go
import pandas as pd
rows=[['501-600','15','122.58333','45.36667'],
['till 500','4','12.5','27.5'],
['more 1001','41','-115.53333','38.08'],
]
colmns=['bins','data','longitude','latitude']
df=pd.DataFrame(data=rows, columns=colmns)
@dsibi
dsibi / scratch_M_CalcLabels.py
Created May 27, 2020 15:06
Meteors Meteors
#In the code below I have marker labels on the map itself.
# I put this piece of code:
# float(d) + 5 for d in df["longitude"]],
# lat=[float(d) + 0 for d in df["latitude"]]
# to make these labels close to the markers. But in case of resizing of map these labels looks weird.
# I believe that it is possible to put into condition of labels position not only absolute values
# as it is now, but some sort of dependency between labels coordinates and values in data.
import plotly.express as px
import plotly.graph_objs as go
#Now this part of code gives me figures for each cells on each map region, even on these which has no data at all. How to show it only for regions which has values in initial table?
import matplotlib as mpl
import matplotlib.pyplot as plt
import geopandas as gpd
import pandas as pd
...
variable = 'price'