This media is not supported in your browser
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
https://www.youtube.com/watch?v=b7BFQB2MF2w
@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Start managing experiments, logging prompts, and tracking your code.
Самый простой способ улучшения среды разработки:
Начните управлять тестами, регистрировать подсказки и отслеживать свой код.
Вы можете сделать все sэто бесплатно, используя такой инструмент, как
Cometml,
с помощью пары строк кода.Посмотрите на прилагаемый скриншот:
Интеграция
Comet + OpenAI
будет отслеживать все автоматически:- сообщения и function_call как входы
- варианты как выходы
- токен использования как метаданные
- работми с метаданными
pip install comet_llm
Этот блокнот Colab продемонстрирует вам пример работы
Cometml
:https://colab.research.google.com/github/comet-ml/comet-examples/blob/master/integrations/llm/openai/notebooks/Comet_and_OpenAI.ipynb#scrollTo=A0-thQauBRRL
▪ Github
@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
We recommend storing sensitive information in an .env file and loading it into a Python script using python-dotenv.
🔒Безопасность хранения данных в Python🔒
Рекомендуется хранить конфиденциальную информацию в файле .env и загружать ее в сценарий Python с помощью python-dotenv.
Это позволяет защитить информацию от раскрытия в кодовой базе или системах контроля версий.
@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
https://www.youtube.com/watch?v=Rj4qq-iQepg
Вот Google Colab с кодом для обоих способов:
1 - https://colab.research.google.com/drive/1gYaKcQ1-wDjzoVK5k8QQ13M7XcyP--rE?usp=sharing
2 - https://colab.research.google.com/drive/1vN84lTEeACqu4EmVdQiVLgGDMSQBn_ij?usp=sharing
@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
GAOJGY8XMAAiqAQ.jpeg
706.7 KB
💥 Here is an amazing Python cheat sheet for you all!
Объемная шпаргалка по Python по всем основным темам.
@pythonl
Объемная шпаргалка по Python по всем основным темам.
@pythonl
🦾 nrich
A command-line tool to quickly analyze all IPs in a file and see which ones have open ports/ vulnerabilities.
Инструмент командной строки, позволяющий быстро проанализировать все IP-адреса в файле и увидеть, какие из них имеют открытые порты/уязвимости. Также может передавать данные из stdin для использования в конвейере данных.
▪ GIthub
@pythonl
A command-line tool to quickly analyze all IPs in a file and see which ones have open ports/ vulnerabilities.
Инструмент командной строки, позволяющий быстро проанализировать все IP-адреса в файле и увидеть, какие из них имеют открытые порты/уязвимости. Также может передавать данные из stdin для использования в конвейере данных.
wget https://gitlab.com/api/v4/projects/33695681/packages/generic/nrich/latest/nrich_latest_x86_64.deb
$ sudo dpkg -i nrich_latest_x86_64.deb
▪ GIthub
@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
Python-модуль для получения данных о акциях/криптовалютах из API Alpha Vantage
Бесплатный API для получения финансовых данных и индикаторов в реальном времени.
pip install alpha_vantage
from alpha_vantage.timeseries import TimeSeries
import matplotlib.pyplot as plt
ts = TimeSeries(key='YOUR_API_KEY', output_format='pandas')
data, meta_data = ts.get_intraday(symbol='MSFT',interval='1min', outputsize='full')
data['4. close'].plot()
plt.title('Intraday Times Series for the MSFT stock (1 min)')
plt.show()
▪Github@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
SQLModel 0.0.14
с поддержкой pydantic v2 🎉Уверен, что это самый большой релиз за все время 🤓.
SQLModel
- это библиотека для взаимодействия с базами данных SQL из кода Python, с объектами Python. Она создана для того, чтобы быть интуитивно понятной, простой в использовании, хорошо совместимой и надежной.$ pip install sqlmodel
▪ Github
@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
Команда Django выпустила Django 5.0.
https://www.djangoproject.com/weblog/2023/dec/04/django-50-released/
@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
"Библиотека QuantStats на языке Python, которая выполняет расчет портфеля, позволяя инвесторам и портфельным менеджерам лучше понимать свою работу, предоставляя им углубленную аналитику и метрики риска."
%matplotlib inline
import quantstats as qs
# extend pandas functionality with metrics, etc.
qs.extend_pandas()
# fetch the daily returns for a stock
stock = qs.utils.download_returns('META')
# show sharpe ratio
qs.stats.sharpe(stock)
# or using extend_pandas() :)
stock.sharpe()
▪ Github
@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
carbon.png
601.4 KB
Код для управление камеры безопасности на OpenCV Python.
import cv2
import time
import datetime
cap = cv2.VideoCapture(0)
face_cascade = cv2.CascadeClassifier(
cv2.data.haarcascades + "haarcascade_frontalface_default.xml")
body_cascade = cv2.CascadeClassifier(
cv2.data.haarcascades + "haarcascade_fullbody.xml")
detection = False
detection_stopped_time = None
timer_started = False
SECONDS_TO_RECORD_AFTER_DETECTION = 5
frame_size = (int(cap.get(3)), int(cap.get(4)))
fourcc = cv2.VideoWriter_fourcc(*"mp4v")
while True:
_, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
bodies = face_cascade.detectMultiScale(gray, 1.3, 5)
if len(faces) + len(bodies) > 0:
if detection:
timer_started = False
else:
detection = True
current_time = datetime.datetime.now().strftime("%d-%m-%Y-%H-%M-%S")
out = cv2.VideoWriter(
f"{current_time}.mp4", fourcc, 20, frame_size)
print("Started Recording!")
elif detection:
if timer_started:
if time.time() - detection_stopped_time >= SECONDS_TO_RECORD_AFTER_DETECTION:
detection = False
timer_started = False
out.release()
print('Stop Recording!')
else:
timer_started = True
detection_stopped_time = time.time()
if detection:
out.write(frame)
# for (x, y, width, height) in faces:
# cv2.rectangle(frame, (x, y), (x + width, y + height), (255, 0, 0), 3)
cv2.imshow("Camera", frame)
if cv2.waitKey(1) == ord('q'):
break
out.release()
cap.release()
cv2.destroyAllWindows()
@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Параметр `
key
` чаще всего встречается в `sorted()
` и `.sort()
` или `max()
` и `min()
`, но он встречается и в других функциях.Вот менее известный случай в менее известной функции из стандартной библиотеки, `
itertools.groupby()
` (не pandas
!)@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
https://www.youtube.com/watch?v=bniEv-dNcy4
@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM