Karmaşık ve popüler kodları tek tıkla kullanabileceğiniz Python kütüphanesi
Project description
PyBasics
Karmaşık ve popüler kodları tek tıkla kullanabileceğiniz Python kütüphanesi.
Özellikler
- Matematik Hesapları: Asal sayılar, kombinasyon, permütasyon, istatistik, lineer regresyon, matris işlemleri
- Basit AI: RAM tabanlı öğrenme ve cevaplama sistemi
- Algoritmalar: Sıralama, arama, graf algoritmaları, dinamik programlama
- String İşlemleri: Palindrom, anagram, metin analizi, regex işlemleri
- Dosya İşlemleri: JSON, CSV, pickle, dosya yönetimi
- Veri İşlemleri: List/dict manipülasyonu, gruplama, filtreleme
Kurulum
pip install pybasics
Veya geliştirme modunda:
git clone https://github.com/kullanici/pybasics.git
cd pybasics
pip install -e .
Hızlı Başlangıç
Matematik İşlemleri
import pybasics as pb
# Asal sayı kontrolü
print(pb.is_prime(17)) # True
# Asal sayılar aralığında
print(pb.primes(1, 50)) # [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
# Kombinasyon ve permütasyon
print(pb.combination(5, 2)) # 10
print(pb.permutation(5, 2)) # 20
# İstatistik
data = [1, 2, 3, 4, 5]
print(pb.average(data)) # 3.0
print(pb.median(data)) # 3
print(pb.std_dev(data)) # 1.414...
# Fibonacci ve faktöriyel
print(pb.fibonacci(10)) # [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
print(pb.factorial(5)) # 120
AI Öğrenme Sistemi
import pybasics as pb
# Veri öğretme
pb.ai_learn("Python programlama dili 1991'de Guido van Rossum tarafından oluşturuldu.")
pb.ai_learn("Python nesne yönelimli, yorumlanan bir dildir.")
pb.ai_learn("Makine öğrenmesi yapay zekanın bir alt dalıdır.")
# Soru sorma
cevap = pb.ai_answer("Python nedir?")
print(cevap)
# AI istatistikleri
print(pb.ai.get_stats())
Algoritmalar
import pybasics as pb
# Sıralama
arr = [64, 34, 25, 12, 22, 11, 90]
print(pb.quick_sort(arr)) # [11, 12, 22, 25, 34, 64, 90]
print(pb.merge_sort(arr)) # [11, 12, 22, 25, 34, 64, 90]
# Arama
print(pb.binary_search([1, 2, 3, 4, 5], 3)) # 2
print(pb.linear_search([1, 2, 3, 4, 5], 4)) # 3
# Graf algoritmaları
graph = pb.Graph()
graph.add_edge('A', 'B')
graph.add_edge('B', 'C')
graph.add_edge('A', 'C')
print(graph.bfs('A')) # ['A', 'B', 'C']
print(graph.dfs('A')) # ['A', 'B', 'C']
print(graph.shortest_path('A', 'C')) # ['A', 'C']
# Dinamik programlama
print(pb.knapsack_01([1, 2, 3], [6, 10, 12], 5)) # 22
print(pb.coin_change([1, 2, 5], 11)) # 3 (5+5+1)
print(pb.climb_stairs(10)) # 89
String İşlemleri
import pybasics as pb
# Temel işlemler
print(pb.reverse_string("Merhaba")) # abahreM
print(pb.is_palindrome("ana")) # True
print(pb.count_vowels("Merhaba")) # 3
# Metin analizi
text = "Python çok güzel bir dil. Python öğrenmesi kolaydır."
print(pb.most_common_word(text)) # python
print(pb.word_frequency(text)) # {'python': 2, 'çok': 1, ...}
print(pb.longest_word(text)) # öğrenmesi
# Format dönüşümleri
print(pb.camel_case("merhaba dünya")) # merhabaDünya
print(pb.snake_case("merhaba dünya")) # merhaba_dünya
print(pb.kebab_case("merhaba dünya")) # merhaba-dünya
print(pb.slugify("Merhaba Dünya!")) # merhaba-dunya
# Bilgi çıkarma
text = "İletişim: test@email.com veya https://site.com"
print(pb.extract_emails(text)) # ['test@email.com']
print(pb.extract_urls(text)) # ['https://site.com']
# Benzerlik hesaplama
print(pb.levenshtein_distance("kedi", "keli")) # 1
print(pb.similarity_ratio("python", "python")) # 1.0
Dosya İşlemleri
import pybasics as pb
# Temel okuma/yazma
pb.write_file("test.txt", "Merhaba Dünya!")
content = pb.read_file("test.txt")
# JSON
pb.write_json("data.json", {"isim": "Ali", "yaş": 25})
data = pb.read_json("data.json")
# CSV
records = [{"ad": "Ali", "yaş": 25}, {"ad": "Veli", "yaş": 30}]
pb.write_csv("data.csv", records)
rows = pb.read_csv("data.csv")
# Dosya yönetimi
print(pb.file_exists("test.txt")) # True
print(pb.get_file_size("test.txt")) # 15
print(pb.list_files(".")) # ['./test.txt', ...]
# Dosya arama
py_files = pb.find_files(".", "*.py")
# Yedekleme
pb.backup_file("test.txt")
Veri İşlemleri
import pybasics as pb
# List işlemleri
data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(pb.chunk_list(data, 3)) # [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]]
print(pb.flatten_list([[1, 2], [3, 4]])) # [1, 2, 3, 4]
# Dict işlemleri
users = [
{"isim": "Ali", "şehir": "İstanbul", "yaş": 25},
{"isim": "Veli", "şehir": "Ankara", "yaş": 30},
{"isim": "Ayşe", "şehir": "İstanbul", "yaş": 28}
]
# Gruplama
by_city = pb.group_by(users, "şehir")
# {'İstanbul': [{...Ali...}, {...Ayşe...}], 'Ankara': [{...Veli...}]}
# Sıralama ve filtreleme
sorted_users = pb.sort_by(users, "yaş", reverse=True)
istanbul_users = pb.filter_by(users, "şehir", "İstanbul")
# Veri çekme
isimler = pb.pluck(users, "isim") # ['Ali', 'Veli', 'Ayşe']
# İstatistiksel işlemler
numbers = [1, 2, 3, 4, 5, 100]
print(pb.normalize(numbers)) # [0.0, 0.01..., 0.02..., 0.03..., 0.04..., 1.0]
print(pb.standardize(numbers)) # Z-score normalizasyonu
print(pb.outliers(numbers)) # [100]
print(pb.quartiles(numbers)) # {'q1': 2.0, 'q2': 3.5, 'q3': 4.75}
# Train/test bölme
train, test = pb.split_train_test(data, 0.8)
Modüller
| Modül | Açıklama |
|---|---|
math_utils |
Matematik ve istatistik fonksiyonları |
ai_simple |
Basit AI öğrenme ve cevaplama sistemi |
algorithms |
Sıralama, arama, graf ve DP algoritmaları |
string_utils |
Metin işleme ve analiz fonksiyonları |
file_utils |
Dosya okuma/yazma ve yönetimi |
data_utils |
Liste ve dict manipülasyon araçları |
Gereksinimler
- Python 3.7+
Lisans
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pbasic-1.0.0-py3-none-any.whl
(17.2 kB
view details)
File details
Details for the file pbasic-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pbasic-1.0.0-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b778a65bcb1bcdc90328659a047770d99b1639215b431c9cda2aff0b626cbd97
|
|
| MD5 |
61a0396e763f972540f33155c2dd3d99
|
|
| BLAKE2b-256 |
111f9f212a6decb13faadc537a70ae6bde896389c2a052d5116436967848c7a1
|