{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Exercise 2 - Pandas part 2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Note**: Throughout the exercise, the original data frame is to be processed!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "1 Read the content of the `data_export.csv` file saved at the end of the previous exercise into the dataframe so that the `Unnamed 0` column is not created when the file is read." ] }, { "cell_type": "code", "execution_count": 318, "metadata": {}, "outputs": [], "source": [ "#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "2 Drop the rows with `NaN` values." ] }, { "cell_type": "code", "execution_count": 319, "metadata": {}, "outputs": [], "source": [ "#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "3 Change all values ​​in the fifth and tenth row to `NaN`." ] }, { "cell_type": "code", "execution_count": 320, "metadata": {}, "outputs": [], "source": [ "#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "4 Print the number of `NaN` values ​​in each column from the DataFrame object." ] }, { "cell_type": "code", "execution_count": 321, "metadata": {}, "outputs": [], "source": [ "#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "5 Fill in the `NaN` values ​​made above with linear interpolation." ] }, { "cell_type": "code", "execution_count": 322, "metadata": {}, "outputs": [], "source": [ "#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "6 Change the last value of `column1` to 94 and the last value of `column3` to 45." ] }, { "cell_type": "code", "execution_count": 323, "metadata": {}, "outputs": [], "source": [ "#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "7 Add a new column called `column4` to the DataFrame object. This column should include the sum of the columns `column1` and `column3`." ] }, { "cell_type": "code", "execution_count": 324, "metadata": {}, "outputs": [], "source": [ "#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "8 Reset the index of the DataFrame object and print the number of rows." ] }, { "cell_type": "code", "execution_count": 325, "metadata": {}, "outputs": [], "source": [ "#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "9 Make time series data with the length of a DataFrame object in the time interval you want and make it an index column." ] }, { "cell_type": "code", "execution_count": 326, "metadata": {}, "outputs": [], "source": [ "#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "10 Convert all values ​​in `column1` to strings with each zero replaced by an uppercase `ND` character combination." ] }, { "cell_type": "code", "execution_count": 327, "metadata": {}, "outputs": [], "source": [ "#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "11 Make a copy of the DataFrame object, whose column names have been changed to the following: `column5`, `column6`, `column7`, `column8`. After that, make one big DataFrame object, which consists of the original DataFrame and a copy so that they are added next to each other.\n", "\n", "\n", "| column1 | column2 | column3 | column4 | column5 | column6 | column7 | column8 |\n", "| ------------- |:-------------:| -----:| ------------- |:-------------:| -----:|-----:|-----:|\n", "| 0.1 | 0.2 | 0.3 | ... | ... | ... | ... | ... |" ] }, { "cell_type": "code", "execution_count": 328, "metadata": {}, "outputs": [], "source": [ "#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "12 Put the last value of `column5` into a variable and the last value of `column3` into a separate variable from the newly made DataFrame object in string format. Concatenate those variables as a string and remove the last two characters from the result. Finally, remove all dots `.`." ] }, { "cell_type": "code", "execution_count": 329, "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.7.6" } }, "nbformat": 4, "nbformat_minor": 4 }