This repository was archived by the owner on Aug 17, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -128,19 +128,27 @@ const df2 = df.drop('column1');
128128console .log (df2 .listColumns ());
129129// ['column2', 'column3']
130130
131- console .log (Object .is (df2, df));
132- // false. df2 is no longer an instance of df.
131+ console .log (Object .is (df2 . dim () , df . dim () ));
132+ // false, they didn't have the same dimensions . df2 is no longer an instance of df.
133133console .log (
134134 Object .is (
135- df .map (row => row . set ( ' colum2 ' , row . get ( ' column2 ' ) + 8 ) ),
135+ df2 .map (row => row),
136136 df2
137137 )
138138);
139- // false. a modification of df2 send another instance of DataFrame
139+ // false. a modification of df2 send another instance of DataFrame, even if nothing change.
140+
141+ // if we create a new column
142+ df2 .withColumn (' anewcolumn' , row => row .get (' column2' ) + 8 );
143+ console .log (
144+ df2 .select (' anewcolumn' )
145+ );
146+ // NoSuchColumnError
147+ // df2 wasn't mutated
140148
141149```
142150
143- For more informations you can find the API below.
151+ For more informations about all DataFrame manipulations you can find the API below.
144152
145153#### List of available methods and their examples:
146154
You can’t perform that action at this time.
0 commit comments