Conversation
|
Found 2 changed notebooks. Review the changes at https://app-staging.gitnotebooks.com/GitNotebooks/demo/pull/6 |
|
Found 2 changed notebooks. Review the changes at https://app.gitnotebooks.com/GitNotebooks/demo/pull/6 |
There was a problem hiding this comment.
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](02.03-Computation-on-arrays-ufuncs.ipynb) 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.markdown comment
There was a problem hiding this comment.
rng = np.random.RandomState(42)
A = pd.DataFrame(rng.randint(0, 20, (2, 2)),another comment
There was a problem hiding this comment.
# Operating on Data in PandasTest
There was a problem hiding this comment.
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.my reply
There was a problem hiding this comment.
not in diff context a = pd.series
| "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." |
There was a problem hiding this comment.
operating on data in pandas on left
| "editable": true | ||
| }, | ||
| "source": [ | ||
| "### Unsupervised learning: Dimensionality reduction\n", |
| "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." |
There was a problem hiding this comment.
| "Copied from [https://github.com/jakevdp/PythonDataScienceHandbook](https://github.com/jakevdp/PythonDataScienceHandbook) with modifications to demonstrate notebook diffing." |
| "fill = A.stack().sum()\n", | ||
| "A.add(B, fill_value=fill)\n", |
| "# 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", |
There was a problem hiding this comment.
a reply to it actually
There was a problem hiding this comment.
| "fill = A.stack().mean()" | |
| "A.subtract(B, fill_value=fill)", |
| "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", |
There was a problem hiding this comment.
observe that th eindicides
| "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", |
| ], | ||
| "source": [ | ||
| "A.add(B, fill_value=0)" | ||
| "A.subtract(B, fill_value=0.0)\n" |
There was a problem hiding this comment.
| "A.subtract(B, fill_value=0.0)\n" | |
| "A.subtract(B, fill_value=0.0)\n" |
smith-kyle
left a comment
There was a problem hiding this comment.
Just a couple comments, please take another look
| "## 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", |
| "# Large cells? No problem. Cells are collapsed to showcase the diff\n", | ||
| "\n", | ||
| "fill = A.stack().mean()\n", | ||
| "fill = A.stack().sum()\n", |
There was a problem hiding this comment.
please replace this with .add
No description provided.