<jupyter_start><jupyter_text>Homework 3 - Pandas<jupyter_code># Load required modules
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline<jupyter_output><empty_output><jupyter_text>Pandas Introduction Reading File  1.1) Read the CSV file called 'data3.csv' into a dataframe called df.  Data description* Data source: http://www.fao.org/nr/water/aquastat/data/query/index.html* Data, units:* GDP, current USD (CPI adjusted)* NRI, mm/yr* Population density, inhab/km^2* Total area of the country, 1000 ha = 10km^2* Total Population, unit 1000 inhabitants<jupyter_code># your code here<jupyter_output><empty_output><jupyter_text>1.2) Display the first 10 rows of the dataframe.<jupyter_code># your code here<jupyter_output><empty_output><jupyter_text>1.3) Display the column names.<jupyter_code># your code here<jupyter_output><empty_output><jupyter_text>1.4) Use iloc to display the first 3 rows and first 4 columns.<jupyter_code># your code here<jupyter_output><empty_output><jupyter_text>Data Preprocessing 2.1) Find all the rows that  have 'NaN' in the 'Symbol' column. Display first 5 rows. Hint : You might have to use a mask<jupyter_code># your code here<jupyter_output><empty_output><jupyter_text>2.2)  Now, we will try to get rid of the NaN valued rows and columns. First, drop the column 'Other' which only has 'NaN' values. Then drop all other rows that have any column with a value 'NaN'. Store the result in place. Then display the last 5 rows of the dataframe.<jupyter_code># your code here<jupyter_output><empty_output><jupyter_text>2.3) For our analysis we do not want all the columns in our dataframe. Lets  drop all the redundant columns/ features.    **Drop columns**: **Area Id, Variable Id, Symbol**. Save the new dataframe as df1. Display the first 5 rows of the new dataframe.<jupyter_code># your code here<jupyter_output><empty_output><jupyter_text>2.4) Display all the unique values in your new dataframe for each of the columns: Area, Variable Name, Year.<jupyter_code># your code here<jupyter_output><empty_output><jupyter_text>2.5) Display some basic statistical details like percentile, mean, std etc. of our dataframe.<jupyter_code># your code here<jupyter_output><empty_output><jupyter_text>Plot  3.1) Plot a bar graph showing the count for each unique value in the column 'Area'. Give it a title.<jupyter_code># your code here<jupyter_output><empty_output><jupyter_text>Extract specific statistics from the preprocessed data: 4.1)  Create a dataframe 'dftemp' to store rows where Area is 'Iceland'. Display the dataframe.<jupyter_code># your code here<jupyter_output><empty_output><jupyter_text>4.2) Print the years (with the same format as 2.5) when the National Rainfall Index (NRI) was greater than 900 and less than 950 in Iceland. Use the dataframe you created in the previous question 'dftemp'.<jupyter_code># your code here<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08609497779296207, 'fraction_numerical': 0.018448923812777587, 'mean_word_length': 6.0047846889952154, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '13', 'dir': 'jupyter-structured-clean-dedup', 'id': '64569', 'license': 'MIT', 'n_tokens_mistral': 969, 'n_tokens_neox': 927, 'n_words': 350, 'path': 'Homework/Homework 3/pandas-exercise.ipynb', 'repo_name': 'Dexter2389/30-Days-ML', 'size': '2927'}