Skip to content

Commit 94755c4

Browse files
minjk-blgitbook-bot
authored andcommitted
GITBOOK-49: Reshape
1 parent c1e1926 commit 94755c4

File tree

5 files changed

+31
-41
lines changed

5 files changed

+31
-41
lines changed

docs/.gitbook/assets/image (225).png

77.2 KB
Loading

docs/.gitbook/assets/image (226).png

50.4 KB
Loading

docs/.gitbook/assets/image (227).png

36.2 KB
Loading

docs/.gitbook/assets/image (228).png

38.6 KB
Loading

docs/data-analysis/8.-reshape.md

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,63 +4,53 @@ description: Reshape the Data into Long or Wide Format
44

55
# 8. Reshape
66

7+
<figure><img src="../.gitbook/assets/image (225).png" alt="" width="290"><figcaption></figcaption></figure>
78

9+
1. Click the _**Reshape**_ under the _**Data Analysis**_ category.
810

9-
<figure><img src="../.gitbook/assets/image (55).png" alt="" width="278"><figcaption></figcaption></figure>
11+
<figure><img src="../.gitbook/assets/image (226).png" alt="" width="406"><figcaption></figcaption></figure>
1012

11-
1. Choose the _**Reshape**_ under the Data Analysis category.
12-
13-
14-
15-
<figure><img src="../.gitbook/assets/image (56).png" alt="" width="563"><figcaption></figcaption></figure>
16-
17-
2. Select the Reshape type.
18-
19-
&#x20; 2-1. _**Pivot**_: Reshape the data into a wide data format.
20-
21-
&#x20; 2-2. _**Pivot Table**_: Reshape the data into a wide format and apply aggregation functions if duplicate indices or columns exist.
22-
23-
&#x20; 2-3. ape the data into a long data format.
13+
2. **Reshape **_**type**_: Select a reshape type.
14+
1. _**Pivot**_: Reorganize the data into a wide data format.
15+
2. _**Pivot Table**_: Reorganize the data into a wide data format, and apply the _**Aggregation function**_ if there are duplicate indexes or columns.
16+
3. _**Melt**_: Reorganize the data into a long data format.
2417

2518

2619

2720
***
2821

2922
### Pivot & Pivot Table
3023

24+
<figure><img src="../.gitbook/assets/image (227).png" alt="" width="422"><figcaption></figcaption></figure>
3125

32-
33-
<figure><img src="../.gitbook/assets/image (58).png" alt="" width="563"><figcaption></figcaption></figure>
34-
35-
1. Select the DataFrame to be reshaped into wide data.
36-
2. Choose the column to be set as the _**index**_ in the reshaped DataFrame.
37-
3. Select the column to be set as the _**columns**_ in the reshaped DataFrame.
38-
4. Choose the column to fill the _**values**_ in each column of the reshaped DataFrame.
39-
5. \[_**Pivot Table**_] Select which _**aggregation function**_ to apply for duplicate indices or columns. If multiple aggregation functions are selected, the results of each function are individually generated. For example, applying _**Count**_ and _**First**_ aggregation functions to columns A, B, and C would create six columns.
40-
6. Additional code beyond the functionalities provided by Visual Python can be added.
41-
7. Specify the variable name to assign to the result.
42-
8. Reset the index to assign a new default integer index.
43-
9. Preview the code that will be output in _**Code View**_.
44-
10. Preview the resulting DataFrame in _**Data View**_.
45-
11. Execute the code.
26+
1. _**DataFrame**_: Select the dataframe that will be reconstructed _with_ wide data_._
27+
2. _**Index**_: Select a column to set as the index in the reorganized dataframe.
28+
3. _**Columns**_: Select the columns you want to set as columns in the reorganized dataframe.
29+
4. _**Values**_: Select the columns you want to populate with values for each column in the reorganized dataframe.
30+
5. _**Aggregate (Pivot Table)**_: Select the aggregation function you want to apply to the duplicate indexes or columns. If you select multiple aggregation functions, the results of each function are generated separately.&#x20;
31+
1. For example, applying the _**Count**_ and _**First**_ aggregation functions to columns A, B, and C results in a total of six columns.
32+
6. _**User Option**_: You can add options beyond what Visual Python provides.
33+
7. _**Allocate to**_: Specify a variable name to assign to the result.
34+
8. _**Reset Index**_: Reset the index to specify a new default integer index.
35+
9. _**Code View**_: Preview the code that will be output.
36+
10. _**Data View**_: Preview the output to be printed.
37+
11. _**Run**_: Print and run the code.
4638

4739

4840

4941
***
5042

5143
### Melt
5244

53-
54-
55-
<figure><img src="../.gitbook/assets/image (59).png" alt="" width="563"><figcaption></figcaption></figure>
56-
57-
1. Select the DataFrame to be reshaped into long data.
58-
2. Choose the column(s) to be specified as fixed variables in the reshaped DataFrame. These columns will be retained as they are in the reshaped DataFrame.
59-
3. The names of the selected column(s) will be filled in the '_**A**_' column of the reshaped DataFrame, and the corresponding values from the original DataFrame will be filled in the '_**B**_' column.
60-
4. Optionally provide additional desired options.
61-
5. Specify the variable name to assign to the result.
62-
6. Reset the index to assign a new default integer index.
63-
7. Preview the code that will be output in _**Code View**_.
64-
8. Preview the resulting DataFrame in _**Data View**_.
65-
9. Execute the code.
45+
<figure><img src="../.gitbook/assets/image (228).png" alt="" width="449"><figcaption></figcaption></figure>
46+
47+
1. _**DataFrame**_: Select the dataframe that will be reconstructed with long data_._
48+
2. _**Id**_: Select the column(s) you want to designate as fixed variables in the reorganized dataframe. These columns will remain intact in the reorganized dataframe.
49+
3. The names of the column(s) selected in _**Value** are_ populated in the _**Var name**_ column of the reconstructed dataframe, and the values are populated in the _**Value name**_ column.
50+
4. _**User Option**_: You can add options beyond what Visual Python provides.
51+
5. _**Allocate to**_: Specify a variable name to assign to the result.
52+
6. _**Reset Index**_: Reset the index to specify a new default integer index.
53+
7. _**Code View**_: Preview the code that will be output.
54+
8. _**Data View**_: Preview the output that will be printed.
55+
9. _**Run**_: Print and run the code.
6656

0 commit comments

Comments
 (0)