clean-data-tools 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- clean_data_tools-0.1.0/LICENSE +21 -0
- clean_data_tools-0.1.0/PKG-INFO +334 -0
- clean_data_tools-0.1.0/README.md +312 -0
- clean_data_tools-0.1.0/pyproject.toml +34 -0
- clean_data_tools-0.1.0/setup.cfg +4 -0
- clean_data_tools-0.1.0/src/clean_data_tools.egg-info/PKG-INFO +334 -0
- clean_data_tools-0.1.0/src/clean_data_tools.egg-info/SOURCES.txt +13 -0
- clean_data_tools-0.1.0/src/clean_data_tools.egg-info/dependency_links.txt +1 -0
- clean_data_tools-0.1.0/src/clean_data_tools.egg-info/requires.txt +3 -0
- clean_data_tools-0.1.0/src/clean_data_tools.egg-info/top_level.txt +1 -0
- clean_data_tools-0.1.0/src/cleandata/__init__.py +16 -0
- clean_data_tools-0.1.0/src/cleandata/cleaner.py +188 -0
- clean_data_tools-0.1.0/src/cleandata/normalizer.py +121 -0
- clean_data_tools-0.1.0/src/cleandata/outlier.py +147 -0
- clean_data_tools-0.1.0/src/cleandata/utils.py +65 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Hasan Bagheri
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: clean-data-tools
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: ابزارهای قدرتمند برای تمیزکاری و پیشپردازش دادهها
|
|
5
|
+
Author-email: Hasan Bagheri <hasan111bagher@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/0hasanbagheri0/clean-data
|
|
8
|
+
Project-URL: Repository, https://github.com/0hasanbagheri0/clean-data
|
|
9
|
+
Project-URL: Issues, https://github.com/0hasanbagheri0/clean-data/issues
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
15
|
+
Requires-Python: >=3.7
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: pandas>=1.0.0
|
|
19
|
+
Requires-Dist: numpy>=1.18.0
|
|
20
|
+
Requires-Dist: scipy>=1.4.0
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
markdown
|
|
24
|
+
# Clean-Data
|
|
25
|
+
|
|
26
|
+
ابزارهای قدرتمند برای تمیزکاری و پیشپردازش دادهها در پایتون
|
|
27
|
+
|
|
28
|
+
[](https://badge.fury.io/py/clean-data)
|
|
29
|
+
[](https://www.python.org/downloads/)
|
|
30
|
+
[](https://opensource.org/licenses/MIT)
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 🌐 English | [فارسی](#فارسی)
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
# English Documentation
|
|
39
|
+
|
|
40
|
+
## 📁 Clean-Data
|
|
41
|
+
|
|
42
|
+
**Clean-Data** is a powerful library for data cleaning and preprocessing in Python. It simplifies repetitive tasks like handling missing values, removing duplicates, detecting outliers, and normalizing data.
|
|
43
|
+
---
|
|
44
|
+
### ✨ Key Features
|
|
45
|
+
|
|
46
|
+
- **Remove Duplicates**: Eliminate duplicate records easily
|
|
47
|
+
- **Handle Missing Values**: Fill with mean, median, mode, or custom values
|
|
48
|
+
- **Outlier Detection**: Using IQR and Z-Score methods
|
|
49
|
+
- **Data Normalization**: Min-Max, Standardization, and Robust Scaling
|
|
50
|
+
- **Auto Type Conversion**: Convert columns to appropriate types
|
|
51
|
+
- **Quality Report**: Get detailed statistics about your data
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
### 📦 Installation
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install clean-data
|
|
59
|
+
```
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
### 🚀 Quick Start
|
|
63
|
+
```python
|
|
64
|
+
import pandas as pd
|
|
65
|
+
from cleandata import DataCleaner, OutlierDetector, Normalizer, get_data_quality_report
|
|
66
|
+
```
|
|
67
|
+
# Load data
|
|
68
|
+
```bash
|
|
69
|
+
df = pd.read_csv("data.csv")
|
|
70
|
+
```
|
|
71
|
+
# Clean data
|
|
72
|
+
```bash
|
|
73
|
+
cleaner = DataCleaner(df)
|
|
74
|
+
```
|
|
75
|
+
```bash
|
|
76
|
+
cleaner.remove_duplicates()
|
|
77
|
+
```
|
|
78
|
+
```bash
|
|
79
|
+
cleaner.fill_missing("mean")
|
|
80
|
+
```
|
|
81
|
+
```bash
|
|
82
|
+
cleaner.strip_strings()
|
|
83
|
+
```
|
|
84
|
+
# Detect and remove outliers
|
|
85
|
+
```bash
|
|
86
|
+
detector = OutlierDetector(cleaner.get_data())
|
|
87
|
+
```
|
|
88
|
+
```bash
|
|
89
|
+
outliers = detector.detect_iqr()
|
|
90
|
+
```
|
|
91
|
+
```bash
|
|
92
|
+
df_clean = detector.remove_outliers()
|
|
93
|
+
```
|
|
94
|
+
# Normalize
|
|
95
|
+
```bash
|
|
96
|
+
normalizer = Normalizer(df_clean)
|
|
97
|
+
```
|
|
98
|
+
```bash
|
|
99
|
+
df_scaled = normalizer.min_max_scale()
|
|
100
|
+
```
|
|
101
|
+
# Quality report
|
|
102
|
+
```bash
|
|
103
|
+
report = get_data_quality_report(df_clean)
|
|
104
|
+
```
|
|
105
|
+
```bash
|
|
106
|
+
print(report)
|
|
107
|
+
```
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### 📚 API Reference
|
|
111
|
+
# DataCleaner Class
|
|
112
|
+
|Method| Description|
|
|
113
|
+
| :--- | :--- |
|
|
114
|
+
|remove_duplicates(subset, keep) |Remove duplicate rows|
|
|
115
|
+
|fill_missing(method, columns) |Fill missing values with mean, median, mode, or custom|
|
|
116
|
+
|remove_missing(threshold, axis) |Remove rows/columns with too many missing values|
|
|
117
|
+
|convert_types(columns) |Auto-convert column data types|
|
|
118
|
+
|strip_strings(columns) |Remove extra whitespace from strings|
|
|
119
|
+
|rename_columns(mapping) |Rename columns|
|
|
120
|
+
|filter_rows(condition) |Filter rows based on condition|
|
|
121
|
+
|reset() |Revert to original data|
|
|
122
|
+
|
|
123
|
+
# OutlierDetector Class
|
|
124
|
+
|
|
125
|
+
|Method |Description|
|
|
126
|
+
| :--- | :--- |
|
|
127
|
+
|detect_iqr(columns, multiplier) |Detect outliers using IQR method|
|
|
128
|
+
|detect_zscore(columns, threshold) |Detect outliers using Z-Score method|
|
|
129
|
+
|remove_outliers(columns, method, threshold) |Remove rows with outliers|
|
|
130
|
+
|replace_outliers(columns, method, multiplier) |Replace outliers with mean/median/custom|
|
|
131
|
+
|
|
132
|
+
# Normalizer Class
|
|
133
|
+
|
|
134
|
+
|Method |Description|
|
|
135
|
+
| :--- | :--- |
|
|
136
|
+
|min_max_scale(columns, feature_range) |Scale to a range (default 0-1)|
|
|
137
|
+
|standardize(columns) |Standardize to mean=0, std=1|
|
|
138
|
+
|robust_scale(columns) |Scale using median and IQR (robust to outliers)|
|
|
139
|
+
|log_transform(columns) |Apply log transformation|
|
|
140
|
+
# Utility Functions
|
|
141
|
+
|Function |Description|
|
|
142
|
+
| :--- | :--- |
|
|
143
|
+
|get_data_quality_report(df)| Get comprehensive data quality report|
|
|
144
|
+
|get_column_info(df, column)| Get detailed info about a specific column|
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### 🛠️ Requirements
|
|
149
|
+
Python 3.7 or higher
|
|
150
|
+
|
|
151
|
+
pandas>=1.0.0
|
|
152
|
+
|
|
153
|
+
numpy>=1.18.0
|
|
154
|
+
|
|
155
|
+
scipy>=1.4.0
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### 🤝 Contributing
|
|
160
|
+
We welcome contributions! Please:
|
|
161
|
+
|
|
162
|
+
1.Fork the repository
|
|
163
|
+
|
|
164
|
+
2.Create a new branch (git checkout -b feature/amazing-feature)
|
|
165
|
+
|
|
166
|
+
3.Commit your changes (git commit -m 'Add amazing feature')
|
|
167
|
+
|
|
168
|
+
4.Push to the branch (git push origin feature/amazing-feature)
|
|
169
|
+
|
|
170
|
+
5.Open a Pull Request
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
### 📄 License
|
|
175
|
+
This project is licensed under the MIT License.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
### 📧 Contact
|
|
180
|
+
Email: hasan111bagher@gmail.com
|
|
181
|
+
|
|
182
|
+
GitHub: 0hasanbagheri0
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
فارسی
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
### 📁 Clean-Data
|
|
192
|
+
Clean-Data یک کتابخانه قدرتمند برای تمیزکاری و پیشپردازش دادهها در پایتون است. این کتابخانه کارهای تکراری مانند مدیریت مقادیر خالی، حذف رکوردهای تکراری، تشخیص دادههای پرت و نرمالسازی دادهها را ساده میکند.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
### ✨ ویژگیهای کلیدی
|
|
197
|
+
|
|
198
|
+
حذف رکوردهای تکراری: حذف آسان رکوردهای تکراری
|
|
199
|
+
|
|
200
|
+
مدیریت مقادیر خالی: پر کردن با میانگین، میانه، مد یا مقدار دلخواه
|
|
201
|
+
|
|
202
|
+
تشخیص دادههای پرت: با روشهای IQR و Z-Score
|
|
203
|
+
|
|
204
|
+
نرمالسازی دادهها: Min-Max، Standardization و Robust Scaling
|
|
205
|
+
|
|
206
|
+
تبدیل خودکار نوع دادهها: تبدیل ستونها به نوع مناسب
|
|
207
|
+
|
|
208
|
+
گزارش کیفیت: دریافت آمار دقیق از دادهها
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
### 📦 نصب
|
|
213
|
+
```bash
|
|
214
|
+
pip install clean-data
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
### 🚀 شروع سریع
|
|
221
|
+
|
|
222
|
+
```python
|
|
223
|
+
|
|
224
|
+
import pandas as pd
|
|
225
|
+
from cleandata import DataCleaner, OutlierDetector, Normalizer, get_data_quality_report
|
|
226
|
+
```
|
|
227
|
+
# بارگذاری داده
|
|
228
|
+
```bash
|
|
229
|
+
df = pd.read_csv("data.csv")
|
|
230
|
+
```
|
|
231
|
+
# تمیزکاری
|
|
232
|
+
```bash
|
|
233
|
+
cleaner = DataCleaner(df)
|
|
234
|
+
```
|
|
235
|
+
```bash
|
|
236
|
+
cleaner.remove_duplicates()
|
|
237
|
+
```
|
|
238
|
+
```bash
|
|
239
|
+
cleaner.fill_missing("mean")
|
|
240
|
+
```
|
|
241
|
+
```bash
|
|
242
|
+
cleaner.strip_strings()
|
|
243
|
+
```
|
|
244
|
+
# تشخیص و حذف دادههای پرت
|
|
245
|
+
```bash
|
|
246
|
+
detector = OutlierDetector(cleaner.get_data())
|
|
247
|
+
```
|
|
248
|
+
```bash
|
|
249
|
+
outliers = detector.detect_iqr()
|
|
250
|
+
```
|
|
251
|
+
```bash
|
|
252
|
+
df_clean = detector.remove_outliers()
|
|
253
|
+
```
|
|
254
|
+
# نرمالسازی
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
normalizer = Normalizer(df_clean)
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
```bash
|
|
261
|
+
df_scaled = normalizer.min_max_scale()
|
|
262
|
+
```
|
|
263
|
+
# گزارش کیفیت
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
report = get_data_quality_report(df_clean)
|
|
267
|
+
print(report)
|
|
268
|
+
```
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
### 📚 راهنمای توابع
|
|
272
|
+
# کلاس DataCleaner
|
|
273
|
+
|تابع |توضیح|
|
|
274
|
+
| :--- | :--- |
|
|
275
|
+
|remove_duplicates(subset, keep)| حذف سطرهای تکراری|
|
|
276
|
+
|fill_missing(method, columns) |پر کردن مقادیر خالی با میانگین، میانه، مد یا مقدار دلخواه|
|
|
277
|
+
|remove_missing(threshold, axis)| حذف سطرها/ستونهایی که مقادیر خالی زیادی دارند|
|
|
278
|
+
|convert_types(columns)| تبدیل خودکار نوع ستونها|
|
|
279
|
+
|strip_strings(columns)| حذف فاصلههای اضافی از رشتهها|
|
|
280
|
+
|rename_columns(mapping)| تغییر نام ستونها|
|
|
281
|
+
|filter_rows(condition)| فیلتر کردن سطرها بر اساس شرط|
|
|
282
|
+
|reset()| بازگشت به دادههای اصلی|
|
|
283
|
+
# کلاس OutlierDetector
|
|
284
|
+
|تابع |توضیح|
|
|
285
|
+
| :--- | :--- |
|
|
286
|
+
|detect_iqr(columns, multiplier) |تشخیص دادههای پرت با روش IQR|
|
|
287
|
+
|detect_zscore(columns, threshold) |تشخیص دادههای پرت با روش Z-Score|
|
|
288
|
+
|remove_outliers(columns, method, threshold) |حذف سطرهای حاوی دادههای پرت|
|
|
289
|
+
|replace_outliers(columns, method, multiplier) |جایگزینی دادههای پرت با میانگین/میانه/مقدار دلخواه|
|
|
290
|
+
# کلاس Normalizer
|
|
291
|
+
|تابع |توضیح|
|
|
292
|
+
| :--- | :--- |
|
|
293
|
+
|min_max_scale(columns, feature_range) |مقیاسسازی به بازه مشخص (پیشفرض ۰ تا ۱)|
|
|
294
|
+
|standardize(columns) |استانداردسازی (میانگین صفر، انحراف معیار یک)|
|
|
295
|
+
|robust_scale(columns) |مقیاسسازی مقاوم به دادههای پرت (با میانه و IQR)|
|
|
296
|
+
|log_transform(columns)| اعمال تبدیل لگاریتمی|
|
|
297
|
+
# توابع کمکی
|
|
298
|
+
|تابع |توضیح|
|
|
299
|
+
| :--- | :--- |
|
|
300
|
+
|get_data_quality_report(df) |دریافت گزارش کامل کیفیت داده|
|
|
301
|
+
|get_column_info(df, column) |دریافت اطلاعات دقیق یک ستون خاص|
|
|
302
|
+
|
|
303
|
+
### 🛠️ نیازمندیها
|
|
304
|
+
|
|
305
|
+
Python 3.7 یا بالاتر
|
|
306
|
+
|
|
307
|
+
pandas>=1.0.0
|
|
308
|
+
|
|
309
|
+
numpy>=1.18.0
|
|
310
|
+
|
|
311
|
+
scipy>=1.4.0
|
|
312
|
+
|
|
313
|
+
### 🤝 مشارکت
|
|
314
|
+
از مشارکت شما استقبال میکنیم! لطفاً:
|
|
315
|
+
|
|
316
|
+
1.مخزن را Fork کنید
|
|
317
|
+
|
|
318
|
+
2.یک شاخه جدید بسازید (git checkout -b feature/amazing-feature)
|
|
319
|
+
|
|
320
|
+
3.تغییرات را Commit کنید (git commit -m 'Add amazing feature')
|
|
321
|
+
|
|
322
|
+
4.به شاخه خود Push کنید (git push origin feature/amazing-feature)
|
|
323
|
+
|
|
324
|
+
5.یک Pull Request باز کنید
|
|
325
|
+
|
|
326
|
+
### 📄 مجوز
|
|
327
|
+
این پروژه تحت مجوز MIT منتشر شده است.
|
|
328
|
+
|
|
329
|
+
### 📧 ارتباط با من
|
|
330
|
+
ایمیل: hasan111bagher@gmail.com
|
|
331
|
+
|
|
332
|
+
گیتهاب: 0hasanbagheri0
|
|
333
|
+
|
|
334
|
+
✨ اگر این کتابخانه برای شما مفید بود، به آن یک ⭐ در گیتهاب بدهید!
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
markdown
|
|
2
|
+
# Clean-Data
|
|
3
|
+
|
|
4
|
+
ابزارهای قدرتمند برای تمیزکاری و پیشپردازش دادهها در پایتون
|
|
5
|
+
|
|
6
|
+
[](https://badge.fury.io/py/clean-data)
|
|
7
|
+
[](https://www.python.org/downloads/)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 🌐 English | [فارسی](#فارسی)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# English Documentation
|
|
17
|
+
|
|
18
|
+
## 📁 Clean-Data
|
|
19
|
+
|
|
20
|
+
**Clean-Data** is a powerful library for data cleaning and preprocessing in Python. It simplifies repetitive tasks like handling missing values, removing duplicates, detecting outliers, and normalizing data.
|
|
21
|
+
---
|
|
22
|
+
### ✨ Key Features
|
|
23
|
+
|
|
24
|
+
- **Remove Duplicates**: Eliminate duplicate records easily
|
|
25
|
+
- **Handle Missing Values**: Fill with mean, median, mode, or custom values
|
|
26
|
+
- **Outlier Detection**: Using IQR and Z-Score methods
|
|
27
|
+
- **Data Normalization**: Min-Max, Standardization, and Robust Scaling
|
|
28
|
+
- **Auto Type Conversion**: Convert columns to appropriate types
|
|
29
|
+
- **Quality Report**: Get detailed statistics about your data
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### 📦 Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install clean-data
|
|
37
|
+
```
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
### 🚀 Quick Start
|
|
41
|
+
```python
|
|
42
|
+
import pandas as pd
|
|
43
|
+
from cleandata import DataCleaner, OutlierDetector, Normalizer, get_data_quality_report
|
|
44
|
+
```
|
|
45
|
+
# Load data
|
|
46
|
+
```bash
|
|
47
|
+
df = pd.read_csv("data.csv")
|
|
48
|
+
```
|
|
49
|
+
# Clean data
|
|
50
|
+
```bash
|
|
51
|
+
cleaner = DataCleaner(df)
|
|
52
|
+
```
|
|
53
|
+
```bash
|
|
54
|
+
cleaner.remove_duplicates()
|
|
55
|
+
```
|
|
56
|
+
```bash
|
|
57
|
+
cleaner.fill_missing("mean")
|
|
58
|
+
```
|
|
59
|
+
```bash
|
|
60
|
+
cleaner.strip_strings()
|
|
61
|
+
```
|
|
62
|
+
# Detect and remove outliers
|
|
63
|
+
```bash
|
|
64
|
+
detector = OutlierDetector(cleaner.get_data())
|
|
65
|
+
```
|
|
66
|
+
```bash
|
|
67
|
+
outliers = detector.detect_iqr()
|
|
68
|
+
```
|
|
69
|
+
```bash
|
|
70
|
+
df_clean = detector.remove_outliers()
|
|
71
|
+
```
|
|
72
|
+
# Normalize
|
|
73
|
+
```bash
|
|
74
|
+
normalizer = Normalizer(df_clean)
|
|
75
|
+
```
|
|
76
|
+
```bash
|
|
77
|
+
df_scaled = normalizer.min_max_scale()
|
|
78
|
+
```
|
|
79
|
+
# Quality report
|
|
80
|
+
```bash
|
|
81
|
+
report = get_data_quality_report(df_clean)
|
|
82
|
+
```
|
|
83
|
+
```bash
|
|
84
|
+
print(report)
|
|
85
|
+
```
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
### 📚 API Reference
|
|
89
|
+
# DataCleaner Class
|
|
90
|
+
|Method| Description|
|
|
91
|
+
| :--- | :--- |
|
|
92
|
+
|remove_duplicates(subset, keep) |Remove duplicate rows|
|
|
93
|
+
|fill_missing(method, columns) |Fill missing values with mean, median, mode, or custom|
|
|
94
|
+
|remove_missing(threshold, axis) |Remove rows/columns with too many missing values|
|
|
95
|
+
|convert_types(columns) |Auto-convert column data types|
|
|
96
|
+
|strip_strings(columns) |Remove extra whitespace from strings|
|
|
97
|
+
|rename_columns(mapping) |Rename columns|
|
|
98
|
+
|filter_rows(condition) |Filter rows based on condition|
|
|
99
|
+
|reset() |Revert to original data|
|
|
100
|
+
|
|
101
|
+
# OutlierDetector Class
|
|
102
|
+
|
|
103
|
+
|Method |Description|
|
|
104
|
+
| :--- | :--- |
|
|
105
|
+
|detect_iqr(columns, multiplier) |Detect outliers using IQR method|
|
|
106
|
+
|detect_zscore(columns, threshold) |Detect outliers using Z-Score method|
|
|
107
|
+
|remove_outliers(columns, method, threshold) |Remove rows with outliers|
|
|
108
|
+
|replace_outliers(columns, method, multiplier) |Replace outliers with mean/median/custom|
|
|
109
|
+
|
|
110
|
+
# Normalizer Class
|
|
111
|
+
|
|
112
|
+
|Method |Description|
|
|
113
|
+
| :--- | :--- |
|
|
114
|
+
|min_max_scale(columns, feature_range) |Scale to a range (default 0-1)|
|
|
115
|
+
|standardize(columns) |Standardize to mean=0, std=1|
|
|
116
|
+
|robust_scale(columns) |Scale using median and IQR (robust to outliers)|
|
|
117
|
+
|log_transform(columns) |Apply log transformation|
|
|
118
|
+
# Utility Functions
|
|
119
|
+
|Function |Description|
|
|
120
|
+
| :--- | :--- |
|
|
121
|
+
|get_data_quality_report(df)| Get comprehensive data quality report|
|
|
122
|
+
|get_column_info(df, column)| Get detailed info about a specific column|
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
### 🛠️ Requirements
|
|
127
|
+
Python 3.7 or higher
|
|
128
|
+
|
|
129
|
+
pandas>=1.0.0
|
|
130
|
+
|
|
131
|
+
numpy>=1.18.0
|
|
132
|
+
|
|
133
|
+
scipy>=1.4.0
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### 🤝 Contributing
|
|
138
|
+
We welcome contributions! Please:
|
|
139
|
+
|
|
140
|
+
1.Fork the repository
|
|
141
|
+
|
|
142
|
+
2.Create a new branch (git checkout -b feature/amazing-feature)
|
|
143
|
+
|
|
144
|
+
3.Commit your changes (git commit -m 'Add amazing feature')
|
|
145
|
+
|
|
146
|
+
4.Push to the branch (git push origin feature/amazing-feature)
|
|
147
|
+
|
|
148
|
+
5.Open a Pull Request
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
### 📄 License
|
|
153
|
+
This project is licensed under the MIT License.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
### 📧 Contact
|
|
158
|
+
Email: hasan111bagher@gmail.com
|
|
159
|
+
|
|
160
|
+
GitHub: 0hasanbagheri0
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
فارسی
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
### 📁 Clean-Data
|
|
170
|
+
Clean-Data یک کتابخانه قدرتمند برای تمیزکاری و پیشپردازش دادهها در پایتون است. این کتابخانه کارهای تکراری مانند مدیریت مقادیر خالی، حذف رکوردهای تکراری، تشخیص دادههای پرت و نرمالسازی دادهها را ساده میکند.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
### ✨ ویژگیهای کلیدی
|
|
175
|
+
|
|
176
|
+
حذف رکوردهای تکراری: حذف آسان رکوردهای تکراری
|
|
177
|
+
|
|
178
|
+
مدیریت مقادیر خالی: پر کردن با میانگین، میانه، مد یا مقدار دلخواه
|
|
179
|
+
|
|
180
|
+
تشخیص دادههای پرت: با روشهای IQR و Z-Score
|
|
181
|
+
|
|
182
|
+
نرمالسازی دادهها: Min-Max، Standardization و Robust Scaling
|
|
183
|
+
|
|
184
|
+
تبدیل خودکار نوع دادهها: تبدیل ستونها به نوع مناسب
|
|
185
|
+
|
|
186
|
+
گزارش کیفیت: دریافت آمار دقیق از دادهها
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
### 📦 نصب
|
|
191
|
+
```bash
|
|
192
|
+
pip install clean-data
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
### 🚀 شروع سریع
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
|
|
202
|
+
import pandas as pd
|
|
203
|
+
from cleandata import DataCleaner, OutlierDetector, Normalizer, get_data_quality_report
|
|
204
|
+
```
|
|
205
|
+
# بارگذاری داده
|
|
206
|
+
```bash
|
|
207
|
+
df = pd.read_csv("data.csv")
|
|
208
|
+
```
|
|
209
|
+
# تمیزکاری
|
|
210
|
+
```bash
|
|
211
|
+
cleaner = DataCleaner(df)
|
|
212
|
+
```
|
|
213
|
+
```bash
|
|
214
|
+
cleaner.remove_duplicates()
|
|
215
|
+
```
|
|
216
|
+
```bash
|
|
217
|
+
cleaner.fill_missing("mean")
|
|
218
|
+
```
|
|
219
|
+
```bash
|
|
220
|
+
cleaner.strip_strings()
|
|
221
|
+
```
|
|
222
|
+
# تشخیص و حذف دادههای پرت
|
|
223
|
+
```bash
|
|
224
|
+
detector = OutlierDetector(cleaner.get_data())
|
|
225
|
+
```
|
|
226
|
+
```bash
|
|
227
|
+
outliers = detector.detect_iqr()
|
|
228
|
+
```
|
|
229
|
+
```bash
|
|
230
|
+
df_clean = detector.remove_outliers()
|
|
231
|
+
```
|
|
232
|
+
# نرمالسازی
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
normalizer = Normalizer(df_clean)
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
```bash
|
|
239
|
+
df_scaled = normalizer.min_max_scale()
|
|
240
|
+
```
|
|
241
|
+
# گزارش کیفیت
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
report = get_data_quality_report(df_clean)
|
|
245
|
+
print(report)
|
|
246
|
+
```
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
### 📚 راهنمای توابع
|
|
250
|
+
# کلاس DataCleaner
|
|
251
|
+
|تابع |توضیح|
|
|
252
|
+
| :--- | :--- |
|
|
253
|
+
|remove_duplicates(subset, keep)| حذف سطرهای تکراری|
|
|
254
|
+
|fill_missing(method, columns) |پر کردن مقادیر خالی با میانگین، میانه، مد یا مقدار دلخواه|
|
|
255
|
+
|remove_missing(threshold, axis)| حذف سطرها/ستونهایی که مقادیر خالی زیادی دارند|
|
|
256
|
+
|convert_types(columns)| تبدیل خودکار نوع ستونها|
|
|
257
|
+
|strip_strings(columns)| حذف فاصلههای اضافی از رشتهها|
|
|
258
|
+
|rename_columns(mapping)| تغییر نام ستونها|
|
|
259
|
+
|filter_rows(condition)| فیلتر کردن سطرها بر اساس شرط|
|
|
260
|
+
|reset()| بازگشت به دادههای اصلی|
|
|
261
|
+
# کلاس OutlierDetector
|
|
262
|
+
|تابع |توضیح|
|
|
263
|
+
| :--- | :--- |
|
|
264
|
+
|detect_iqr(columns, multiplier) |تشخیص دادههای پرت با روش IQR|
|
|
265
|
+
|detect_zscore(columns, threshold) |تشخیص دادههای پرت با روش Z-Score|
|
|
266
|
+
|remove_outliers(columns, method, threshold) |حذف سطرهای حاوی دادههای پرت|
|
|
267
|
+
|replace_outliers(columns, method, multiplier) |جایگزینی دادههای پرت با میانگین/میانه/مقدار دلخواه|
|
|
268
|
+
# کلاس Normalizer
|
|
269
|
+
|تابع |توضیح|
|
|
270
|
+
| :--- | :--- |
|
|
271
|
+
|min_max_scale(columns, feature_range) |مقیاسسازی به بازه مشخص (پیشفرض ۰ تا ۱)|
|
|
272
|
+
|standardize(columns) |استانداردسازی (میانگین صفر، انحراف معیار یک)|
|
|
273
|
+
|robust_scale(columns) |مقیاسسازی مقاوم به دادههای پرت (با میانه و IQR)|
|
|
274
|
+
|log_transform(columns)| اعمال تبدیل لگاریتمی|
|
|
275
|
+
# توابع کمکی
|
|
276
|
+
|تابع |توضیح|
|
|
277
|
+
| :--- | :--- |
|
|
278
|
+
|get_data_quality_report(df) |دریافت گزارش کامل کیفیت داده|
|
|
279
|
+
|get_column_info(df, column) |دریافت اطلاعات دقیق یک ستون خاص|
|
|
280
|
+
|
|
281
|
+
### 🛠️ نیازمندیها
|
|
282
|
+
|
|
283
|
+
Python 3.7 یا بالاتر
|
|
284
|
+
|
|
285
|
+
pandas>=1.0.0
|
|
286
|
+
|
|
287
|
+
numpy>=1.18.0
|
|
288
|
+
|
|
289
|
+
scipy>=1.4.0
|
|
290
|
+
|
|
291
|
+
### 🤝 مشارکت
|
|
292
|
+
از مشارکت شما استقبال میکنیم! لطفاً:
|
|
293
|
+
|
|
294
|
+
1.مخزن را Fork کنید
|
|
295
|
+
|
|
296
|
+
2.یک شاخه جدید بسازید (git checkout -b feature/amazing-feature)
|
|
297
|
+
|
|
298
|
+
3.تغییرات را Commit کنید (git commit -m 'Add amazing feature')
|
|
299
|
+
|
|
300
|
+
4.به شاخه خود Push کنید (git push origin feature/amazing-feature)
|
|
301
|
+
|
|
302
|
+
5.یک Pull Request باز کنید
|
|
303
|
+
|
|
304
|
+
### 📄 مجوز
|
|
305
|
+
این پروژه تحت مجوز MIT منتشر شده است.
|
|
306
|
+
|
|
307
|
+
### 📧 ارتباط با من
|
|
308
|
+
ایمیل: hasan111bagher@gmail.com
|
|
309
|
+
|
|
310
|
+
گیتهاب: 0hasanbagheri0
|
|
311
|
+
|
|
312
|
+
✨ اگر این کتابخانه برای شما مفید بود، به آن یک ⭐ در گیتهاب بدهید!
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "clean-data-tools"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "ابزارهای قدرتمند برای تمیزکاری و پیشپردازش دادهها"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{name = "Hasan Bagheri", email = "hasan111bagher@gmail.com"}
|
|
12
|
+
]
|
|
13
|
+
license = {text = "MIT"}
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Topic :: Scientific/Engineering :: Information Analysis",
|
|
20
|
+
]
|
|
21
|
+
requires-python = ">=3.7"
|
|
22
|
+
dependencies = [
|
|
23
|
+
"pandas>=1.0.0",
|
|
24
|
+
"numpy>=1.18.0",
|
|
25
|
+
"scipy>=1.4.0"
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Homepage = "https://github.com/0hasanbagheri0/clean-data"
|
|
30
|
+
Repository = "https://github.com/0hasanbagheri0/clean-data"
|
|
31
|
+
Issues = "https://github.com/0hasanbagheri0/clean-data/issues"
|
|
32
|
+
|
|
33
|
+
[tool.setuptools.packages.find]
|
|
34
|
+
where = ["src"]
|