{ "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 following NumPy array `data`, create a pandas DataFrame named `first_data_frame` that contains the same elements. Print the DataFrame to make sure the operation executed successfully." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "data = np.round(np.random.randn(5,5),1)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Solution goes here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 4\n", "Assign the values of `row_labels` to the index of `first_data_frame`. Print the DataFrame to make sure the operation executed successfully.\n", "\n", "Hint: It will be easier to overwrite `first_data_frame` by using another `pd.DataFrame` method." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "row_labels = ['one','two','three','four','five']" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Solution goes here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 5\n", "Assign the values of `column_labels` to the columns of `first_data_frame`. Note that there are two main ways to do this - you are free to chose the method of your choice. Print the DataFrame to make sure the operation executed successfully." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "column_labels = ['alpha','beta','charlie','delta','echo']" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Solution goes here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 6\n", "Create a pandas Series named `my_series` that contains the values from row `alpha` of `first_data_frame`. Print `my_series` to make sure the operation executed successfully." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Solution goes here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 7\n", "Create a new DataFrame called `second_data_frame` that is equal to `first_data_frame` but without row `one`. Print `second_data_frame` to make sure the operation executed successfully." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Solution goes here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 8\n", "Create a new DataFrame called `third_data_frame` that is equal to `second_data_frame`, but without row `charlie`. Print `third_data_frame` to make sure the operation executed successfully." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Solution goes here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 9\n", "Create a variable called `row_two` that is equal to row `two` from `third_data_frame`. Print `row_two` to make sure the operation executed successfully." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Solution goes here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 10\n", "Print the shape of new_data." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "new_data = np.round(np.random.randn(5,5),1)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Solution goes here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 11\n", "Print a DataFrame that contains boolean values that indicate whether the elements of `new_data` are greater than 1." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Solution goes here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 12\n", "Print a NumPy array that contains only the elements of `new_data` that are greater than 1." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Solution goes here" ] } ], "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.7.6" } }, "nbformat": 4, "nbformat_minor": 4 }