This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Developed by MikyPo | |
| # More code for DA here: https://dzen.ru/mikypo | |
| # Импорт библиотек | |
| import pandas as pd | |
| import numpy as np | |
| import openpyxl | |
| import plotly.express as px | |
| import plotly.graph_objects as go | |
| import warnings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Developed by MikyPo | |
| # More code for DA here: https://dzen.ru/mikypo | |
| # Импорт нужных библиотек | |
| import duckdb | |
| import pandas as pd | |
| import numpy as np | |
| # Для вывода подсвеченного кода SQL | |
| from rich.console import Console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Developed by MikyPo | |
| # More code for DA here: https://dzen.ru/mikypo | |
| """ | |
| Подключение к БД PostgreSQL на Railway hosting | |
| """ | |
| !pip install psycopg2-binary --quiet # Ставим psycopg, если ещё не установлено | |
| # 1. Ставим нужные библиотеки | |
| import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from openpyxl import load_workbook | |
| from tqdm import tqdm | |
| # Путь к файлу | |
| filename = 'data.xlsx' | |
| # Загружаем книгу | |
| wb = load_workbook(filename, read_only=True) | |
| # Возвращает активный (выбранный по умолчанию) лист Excel-файла, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import base64 | |
| import json | |
| import os | |
| import requests | |
| import time | |
| from io import BytesIO | |
| from dotenv import load_dotenv | |
| from IPython.display import display, Image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import numpy as np | |
| from tqdm import tqdm | |
| # 1. Генерация тестовой таблицы (1 000 000 строк) | |
| def generate_test_data(rows=1000000): | |
| data = { | |
| 'id': np.arange(1, rows+1), | |
| 'value': np.random.rand(rows) * 100, | |
| 'category': np.random.choice(['A', 'B', 'C', 'D'], size=rows) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| '''Подсчёт сессий пользователей на сайте''' | |
| # Импорт библиотек | |
| import pandas as pd | |
| import numpy as np | |
| import random | |
| import sqlite3 | |
| from datetime import datetime, timedelta | |
| '''Генерация данных''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import sqlite3 | |
| from contextlib import contextmanager | |
| from IPython.display import display | |
| # Создаем тестовый DataFrame | |
| data = pd.DataFrame({ | |
| 'student': ['Жек Воробьёв', 'Жек Воробьёв', 'Жек Воробьёв', | |
| 'Лёня Каннибов', 'Лёня Каннибов', 'Лёня Каннибов', | |
| 'Толя Старков', 'Толя Старков', 'Толя Старков', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Developed by MikyPo | |
| # More code for DA here: https://dzen.ru/mikypo | |
| !pip install torch diffusers transformers accelerate --quiet | |
| !pip install xformers --quiet | |
| import torch | |
| torch.cuda.empty_cache() # Очистка кеша GPU | |
| from diffusers import AutoPipelineForImage2Image | |
| from diffusers.utils import load_image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Developed by MikyPo | |
| # More code for DA here: https://dzen.ru/mikypo | |
| # Импортируем библиотеки | |
| import matplotlib.pyplot as plt | |
| import sqlite3 | |
| import pandas as pd | |
| from sqlalchemy import create_engine | |
| from matplotlib import pyplot as plt |
NewerOlder