-
Notifications
You must be signed in to change notification settings - Fork 0
Demo pull request #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,24 +11,24 @@ | |
"cell_type": "markdown", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented on notebook # Operating on Data in Pandas Commenting on the header Operating on Data in Pandas There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented on notebook # Operating on Data in Pandas Woo! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented on notebook # Large cells? No problem. Cells are collapsed to showcase the diff
# Large cells? No problem. Cells are collapsed to showcase the diff
# Large cells? No problem. Cells are collapsed to showcase the diff
# Large cells? No problem. Cells are collapsed to showcase the diff
# Large cells? No problem. Cells are collapsed to showcase the diff
# Large cells? No problem. Cells are collapsed to showcase the diff
fill = A.stack().mean() Comment Test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented on notebook Any item for which one or the other does not have an entry is marked with ``NaN``, or "Not a Number," which is how Pandas marks missing data (see further discussion of missing data in [Handling Missing Data](03.04-Missing-Values.ipynb)). Leaving a diff comment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented on notebook One of the essential pieces of NumPy is the ability to perform quick element-wise operations, both with basic arithmetic (addition, subtraction, multiplication, etc.) and with more sophisticated operations (trigonometric functions, exponential and logarithmic functions, etc.).
Pandas inherits much of this functionality from NumPy, and the ufuncs that we introduced in [Computation on NumPy Arrays: Universal Functions](https://gitnotebooks.com/blog) are key to this.
Pandas includes a couple useful twists, however: for unary operations like negation and trigonometric functions, these ufuncs will *preserve index and column labels* in the output, and for binary operations such as addition and multiplication, Pandas will automatically *align indices* when passing the objects to the ufunc.
This means that keeping the context of data and combining data from different sources–both potentially error-prone tasks with raw NumPy arrays–become essentially foolproof ones with Pandas. Leaving a comment here! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolving this comment! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented on notebook A.subtract(B, fill_value=0) Leaving a comment! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented on notebook Observe that the indices align accurately regardless of their sequence in the two objects, and the result's indices are organized in ascending order. Adding another comment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented on notebook A.subtract(B, fill_value=0) Leaving a comment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No changes needed! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented on notebook Notice that indices are aligned correctly irrespective of their order in the two objects, and indices in the result are sorted. Commenting on other side There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No changes needed! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented on notebook One of the essential pieces of NumPy is the ability to perform quick element-wise operations, both with basic arithmetic (addition, subtraction, multiplication, etc.) and with more sophisticated operations (trigonometric functions, exponential and logarithmic functions, etc.).
Pandas inherits much of this functionality from NumPy, and the ufuncs that we introduced in [Computation on NumPy Arrays: Universal Functions](https://gitnotebooks.com/blog) are key to this.
Pandas includes a couple useful twists, however: for unary operations like negation and trigonometric functions, these ufuncs will *preserve index and column labels* in the output, and for binary operations such as addition and multiplication, Pandas will automatically *align indices* when passing the objects to the ufunc. comment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented on notebook Any item for which one or the other does not have an entry is marked with ``NaN``, or "Not a Number," which is how Pandas marks missing data (see further discussion of missing data in [Handling Missing Data](03.04-Missing-Values.ipynb)). Can I suggest the change here ? +- type changes in git There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented on notebook Observe that the indices align accurately regardless of their sequence in the two objects, and the result's indices are organized in ascending order.
As was the case with ``Series``, we can use the associated object's arithmetic method and pass any desired ``fill_value`` to be used in place of missing entries. Comment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented on notebook One of the essential pieces of NumPy is the ability to perform quick element-wise operations, both with basic arithmetic (addition, subtraction, multiplication, etc.) and with more sophisticated operations (trigonometric functions, exponential and logarithmic functions, etc.).
Pandas inherits much of this functionality from NumPy, and the ufuncs that we introduced in [Computation on NumPy Arrays: Universal Functions](https://gitnotebooks.com/blog) are key to this.
Pandas includes a couple useful twists, however: for unary operations like negation and trigonometric functions, these ufuncs will *preserve index and column labels* in the output, and for binary operations such as addition and multiplication, Pandas will automatically *align indices* when passing the objects to the ufunc. my comment! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented on notebook Any item for which one or the other does not have an entry is marked with ``NaN``, or "Not a Number," which is how Pandas marks missing data (see further discussion of missing data in [Handling Missing Data](03.04-Missing-Values.ipynb)). comment 3 |
||
"metadata": {}, | ||
"source": [ | ||
"Copied from [https://github.com/jakevdp/PythonDataScienceHandbook](https://github.com/jakevdp/PythonDataScienceHandbook)" | ||
"Copied from [https://github.com/jakevdp/PythonDataScienceHandbook](https://github.com/jakevdp/PythonDataScienceHandbook) with modifications to demonstrate notebook diffing." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"One of the essential pieces of NumPy is the ability to perform quick element-wise operations, both with basic arithmetic (addition, subtraction, multiplication, etc.) and with more sophisticated operations (trigonometric functions, exponential and logarithmic functions, etc.).\n", | ||
"Pandas inherits much of this functionality from NumPy, and the ufuncs that we introduced in [Computation on NumPy Arrays: Universal Functions](02.03-Computation-on-arrays-ufuncs.ipynb) are key to this.\n", | ||
"Pandas inherits much of this functionality from NumPy, and the ufuncs that we introduced in [Computation on NumPy Arrays: Universal Functions](https://gitnotebooks.com/blog) are key to this.\n", | ||
"\n", | ||
"Pandas includes a couple useful twists, however: for unary operations like negation and trigonometric functions, these ufuncs will *preserve index and column labels* in the output, and for binary operations such as addition and multiplication, Pandas will automatically *align indices* when passing the objects to the ufunc.\n", | ||
"This means that keeping the context of data and combining data from different sources–both potentially error-prone tasks with raw NumPy arrays–become essentially foolproof ones with Pandas.\n", | ||
"We will additionally see that there are well-defined operations between one-dimensional ``Series`` structures and two-dimensional ``DataFrame`` structures." | ||
"We will additionally see that there are well-defined operations between one-dimensional Series structures and two-dimensional DataFrame structures." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 121, | ||
"execution_count": 26, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
|
@@ -48,7 +48,7 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 122, | ||
"execution_count": 27, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
|
@@ -68,7 +68,7 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 123, | ||
"execution_count": 28, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
|
@@ -77,26 +77,26 @@ | |
"data": { | ||
"text/plain": [ | ||
"0 2.0\n", | ||
"1 5.0\n", | ||
"2 9.0\n", | ||
"3 5.0\n", | ||
"1 3.0\n", | ||
"2 3.0\n", | ||
"3 -5.0\n", | ||
"dtype: float64" | ||
] | ||
}, | ||
"execution_count": 123, | ||
"execution_count": 28, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"A.add(B, fill_value=0)" | ||
"A.subtract(B, fill_value=0)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Notice that indices are aligned correctly irrespective of their order in the two objects, and indices in the result are sorted.\n", | ||
"Observe that the indices align accurately regardless of their sequence in the two objects, and the result's indices are organized in ascending order.\n", | ||
"As was the case with ``Series``, we can use the associated object's arithmetic method and pass any desired ``fill_value`` to be used in place of missing entries.\n", | ||
"Here we'll fill with the mean of all values in ``A`` (computed by first stacking the rows of ``A``):" | ||
] | ||
|
@@ -144,40 +144,36 @@ | |
" <th></th>\n", | ||
" <th>A</th>\n", | ||
" <th>B</th>\n", | ||
" <th>C</th>\n", | ||
" </tr>\n", | ||
" </thead>\n", | ||
" <tbody>\n", | ||
" <tr>\n", | ||
" <th>0</th>\n", | ||
" <td>19.00</td>\n", | ||
" <td>20.00</td>\n", | ||
" <td>16.75</td>\n", | ||
" <td>26.0</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>1</th>\n", | ||
" <td>8.00</td>\n", | ||
" <td>3.00</td>\n", | ||
" <td>12.75</td>\n", | ||
" <td>19.0</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>2</th>\n", | ||
" <td>16.75</td>\n", | ||
" <td>10.75</td>\n", | ||
" <td>12.75</td>\n", | ||
" <td>53.0</td>\n", | ||
" <td>56.0</td>\n", | ||
" </tr>\n", | ||
" </tbody>\n", | ||
"</table>\n", | ||
"</div>" | ||
], | ||
"text/plain": [ | ||
" A B C\n", | ||
"0 19.00 20.00 16.75\n", | ||
"1 8.00 3.00 12.75\n", | ||
"2 16.75 10.75 12.75" | ||
" A B C\n", | ||
"0 10.0 26.0 55.0\n", | ||
"1 16.0 19.0 55.0\n", | ||
"2 53.0 56.0 52.0" | ||
] | ||
}, | ||
"execution_count": 127, | ||
"execution_count": 30, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
|
@@ -200,7 +196,7 @@ | |
"# Large cells? No problem. Cells are collapsed to showcase the diff\n", | ||
"# Large cells? No problem. Cells are collapsed to showcase the diff\n", | ||
"\n", | ||
"fill = A.stack().mean()\n", | ||
"fill = A.stack().sum()\n", | ||
"A.add(B, fill_value=fill)\n", | ||
"\n", | ||
"# Large cells? No problem. Cells are collapsed to showcase the diff\n", | ||
|
@@ -225,7 +221,7 @@ | |
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Ufuncs: Operations Between DataFrame and Series\n", | ||
"## Ufuncs: Operations Between DataFrame and Series with a changed header\n", | ||
"\n", | ||
"When performing operations between a ``DataFrame`` and a ``Series``, the index and column alignment is similarly maintained.\n", | ||
"Operations between a ``DataFrame`` and a ``Series`` are similar to operations between a two-dimensional and one-dimensional NumPy array.\n", | ||
|
@@ -234,20 +230,20 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 128, | ||
"execution_count": 31, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"array([[1, 5, 5, 9],\n", | ||
" [3, 5, 1, 9],\n", | ||
" [1, 9, 3, 7]])" | ||
"array([[7, 7, 2, 5],\n", | ||
" [4, 1, 7, 5],\n", | ||
" [1, 4, 0, 9]])" | ||
] | ||
}, | ||
"execution_count": 128, | ||
"execution_count": 31, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
|
@@ -259,7 +255,7 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 129, | ||
"execution_count": 32, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
|
@@ -268,11 +264,11 @@ | |
"data": { | ||
"text/plain": [ | ||
"array([[ 0, 0, 0, 0],\n", | ||
" [ 2, 0, -4, 0],\n", | ||
" [ 0, 4, -2, -2]])" | ||
" [-3, -6, 5, 0],\n", | ||
" [-6, -3, -2, 4]])" | ||
] | ||
}, | ||
"execution_count": 129, | ||
"execution_count": 32, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
|
@@ -285,7 +281,7 @@ | |
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### GitNotebooks v1 Features\n", | ||
"### GitNotebooks v2 Features\n", | ||
"\n", | ||
"<table>\n", | ||
" <thead><tr><th>Feature</th><th>Supported</th></tr></thead>\n", | ||
|
@@ -296,15 +292,15 @@ | |
" </tr>\n", | ||
" <tr>\n", | ||
" <td>Line comments</td>\n", | ||
" <td>✗</td>\n", | ||
" <td>✓</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <td>Markdown comment</td>\n", | ||
" <td>✗</td>\n", | ||
" <td>✓</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <td>Dataframe diffing</td>\n", | ||
" <td>✗</td>\n", | ||
" <td>✓</td>\n", | ||
" </tr>\n", | ||
" </tbody>\n", | ||
"</table>" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented on notebook
pandas-example.ipynb
Cell 12 Line 1## Ufuncs: Operations Between DataFrame and Series with a changed header
"start a review" button didn't work for me - Android chrome