|
1 | 1 | --- |
2 | | -description:Groupthe Data in the DataFrame |
| 2 | +description:Groupdata by some criteria. |
3 | 3 | --- |
4 | 4 |
|
5 | 5 | #6. Groupby |
6 | 6 |
|
| 7 | +<figure><imgsrc="../.gitbook/assets/image.png"alt=""width="341"><figcaption></figcaption></figure> |
7 | 8 |
|
8 | | - |
9 | | -<figure><imgsrc="../.gitbook/assets/image (19).png"alt=""width="293"><figcaption></figcaption></figure> |
10 | | - |
11 | | -1. Select_**Groupby**_ in the Data Analysis category. |
| 9 | +1. Click_**Groupby**_ in the_**Data Analysis**_ category. |
12 | 10 |
|
13 | 11 |
|
14 | 12 |
|
15 | 13 | *** |
16 | 14 |
|
17 | | - |
18 | | - |
19 | | -<figure><imgsrc="../.gitbook/assets/image (20).png"alt=""width="563"><figcaption></figcaption></figure> |
20 | | - |
21 | | -2. Choose the DataFrame to be grouped. |
22 | | - |
23 | | - **Group by column A, Apply grouping to column B, and Use method C.** |
24 | | - |
25 | | -3. For time-related data, check_**Grouper**_ to group data based on periods such as monthly, weekly, or yearly. |
26 | | -4. Check_**Advanced**_ to apply different methods for each column. |
27 | | -5. Specify the variable name to assign to the result. |
28 | | -6. Reset the index to assign a new default integer index. |
29 | | -7. Save and display the result in DataFrame format. |
30 | | -8. Preview the code to be output. |
31 | | -9. Preview the data to be output. |
32 | | -10. Output the result. |
| 15 | +<figure><imgsrc="../.gitbook/assets/image (1).png"alt=""width="527"><figcaption></figcaption></figure> |
| 16 | + |
| 17 | +2._**DataFrame**_: Select the dataframe you want to group by. |
| 18 | +3._**Groupby**_: Group data based on the values in the selected column. For time-related data, check out_Grouper_ to group data based on time periods like monthly, weekly, or yearly. |
| 19 | +4._**Columns**_: Select the columns you want to group by applying the criteria you selected in_**Group by**_. |
| 20 | +5._**Method**_: Choose the information you want to see in the grouped data.  |
| 21 | +1. For example, if you choose_**mean**,_ you'll see the average value for each group. If you want to see different information for each group, use_**Advanced**._ |
| 22 | +6._**Allocate to**_: Specify a variable name to assign to the result. Check_**Reset Index**_ to ignore the existing index and assign a new one. Check_**To DataFrame**_ to save the result in dataframe format. |
| 23 | +7._**Code View**_: Preview the code that will be output. |
| 24 | +8._**Data View**_: Preview the output that will be printed. |
| 25 | +9._**Run**_: Print and run the code. |
33 | 26 |
|