{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 1\n", "Import NumPy under the alias `np`." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 2\n", "Import pandas under the alias `pd`." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 3\n", "Given the pandas Series `my_series`, generate a NumPy array that contains only the unique values from `my_series`. Assign this new array to a variable called `my_array`. Print `my_array` to ensure that the operation has been executed successfully." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "my_series = pd.Series([1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9])\n", "my_series" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Solution goes here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 4\n", "Given the pandas DataFrame `my_data_frame`, generate a NumPy array that contains only the unique values from the second column. Assign this new array to a variable called `another_array`. Print `another_array` to ensure the operation has been executed successfully." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "my_data_frame = pd.DataFrame(np.random.randn(3,5))\n", "my_data_frame" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Solution goes here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 5\n", "Count the occurence of every element within the `my_series` variable that was created earlier in these practice problems." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 6\n", "Given the function `triple_digit`, apply this to every element within `my_series`." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def triple_digit(x):\n", " return x + x*10 + x*100" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Solution goes here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 7\n", "Sort the `my_data_frame` variable that we created earlier based on the contents of its second column." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.2" } }, "nbformat": 4, "nbformat_minor": 4 }