Pandas
Pandas Tool |
Pandas Tool, Python library |
Pandas ek Python library hai jo data analysis aur manipulation ke liye bahut upyogi hoti hai. Ise ek aise tool ki tarah dekha ja sakta hai jo hame data ko aasani se handle karne ki suvidha deta hai.
**DataFrame aur Series:**
Pandas library ke do mukhya data structures hain - DataFrame aur Series.
- **Series**: Ye ek-dimension ka data structure hai jo kisi bhi data type ka data hold kar sakta hai. Isko hum ek column ke roop mein samajh sakte hain.
- **DataFrame**: DataFrame basically ek table hai jo multiple columns (Series) ko hold karta hai. Har column mei alag data type ho sakta hai.
**Data Ko Load Kaise Kare:**
Pandas se aap different formats ke data ko load kar sakte hain jaise CSV, Excel, SQL, JSON, etc.
- CSV file se data load karne ke liye:
```python
df = pd.read_csv('filename.csv')
```
- Excel file se data load karne ke liye:
```python
df = pd.read_excel('filename.xlsx')
```
**Data Ko Explore Kaise Kare:**
Pandas library se data ko explore karna easy hota hai:
- Data ke pehle ya aakhiri 5 rows dekhne ke liye, `head()` aur `tail()` function ka use kiya jata hai:
```python
df.head()
df.tail()
```
- Data ke total rows aur columns dekhne ke liye, `shape` attribute ka use kiya jata hai:
```python
df.shape
```
- Data ki basic statistical details dekhne ke liye, `describe()` function ka use kiya jata hai:
```python
df.describe()
```
- Kisi specific column ke unique values dekhne ke liye, `unique()` function ka use kiya jata hai:
```python
df['Column_Name'].unique()
```
**Data Ko Manipulate Kaise Kare:**
Pandas se aap data ko easily manipulate kar sakte hain:
- Kisi specific column ko select karne ke liye:
```python
df['Column_Name']
```
- Multiple columns ko select karne ke liye:
```python
df[['Column1', 'Column2']]
```
- Kisi specific condition ke according data filter karne ke liye:
```python
df[df['Age'] > 25]
```
- New column add karne ke liye:
```python
df['New_Column'] = df['Column1'] + df['Column2']
```
- Missing values ko fill karne ke liye:
```python
df.fillna(value)
```
- Data ko sort karne ke liye:
```python
df.sort_values('Column_Name')
```
**Data Aggregation:**
Data aggregation ka use statistics calculate karne ke liye kiya jata hai, jaise mean, median, sum, etc.
- Group-wise statistics calculate karne ke liye `groupby()` function ka use kiya jata hai:
```python
df.groupby('Column_Name').mean()
```
Pandas ke bahut se features aur functions hain jo data analysis ko aasan banate hain. Pandas library ke bare mein aur jyada janakri ke liye, aap Pandas ki official documentation dekh sakte hain ya fir online tutorials follow kar sakte hain.