<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 IS-360 Project 3
Step1:  Reading CSV File into Pandas DataFrame
READING CSV
Step2:  I have a few things to do, first i want to flip the positions of columns with the of row index variables.
I've chosen to use the transpose function, which causes the columns and index to change places.
Step3:  Issues with the way the data is stored in the DataFrame object, first of all since the data includes signs such as commas, and currency signs, its presented as a string format.
<i> I would like to remove any characters that do not represent number values and return these as intergers. </i>
Step4:  The line above returns the desired result removing, the varchars from the cells and returning their values as intergers that can be computed and analayzed further.
Step5:  The line above repeats the same process for the 'Life Expectancy' Column and returns their values as intergers. The only diference is there is no replacement of varchars since the cells do not contain other than numberical characters.
Step6:  What is returned after cells are cleaned and returned as computable data, is a clean DataFrame object.
Step7:  <img src="incomearea1.png" alt="Income Area Graph">
This AREA graph doesnt do a great job at displaying the diference or similarities between Income VS Life Expectancy. This could be due to the colors or the choice of graph.
Step8:  <img src="incomebar1.png" alt="Income Area Graph">
This bar chart does a good job of noting the diferences between income in measured countries, but does do well for representing their relationship to the Life Expectancy, alot of these values are not even visible.
Step9:  <img src="income_scatter.png" alt="Income Scatter Graph">
The Scatter plot above, does a great job of representing the diferences between the ages and Life Expectancy notably the diference between Incomes over 40k, which in relation to the diference between 20k and below 1k, are very simliar.
Step10:  <img src="bar2income.png" alt="Income Bar Graph">
I think removing Ethiopia from the Data was crucial to understanding why the Income / Person has little effect, given the diference in Life Expectancy ranges between 40k, 19k, and 16k earners.
<ASSISTANT_TASK:>
Python Code:
import pandas as pd
import csv
import matplotlib.pyplot as plt
Explanation: IS-360 Project 3
End of explanation
income_df = pd.read_csv('LifeExpectancyIncome.csv')
income_df
Explanation: Reading CSV File into Pandas DataFrame
READING CSV: I want to read the csv using the Pandas '.read_csv' which returns a DataFrame Object.
End of explanation
income_df = income_df.set_index('Country').transpose()
income_df
Explanation: I have a few things to do, first i want to flip the positions of columns with the of row index variables.
I've chosen to use the transpose function, which causes the columns and index to change places.
End of explanation
income_df['Income / Person'] = income_df['Income / Person'].str.replace(r'[^-+\d.]', '').astype(int)
Explanation: Issues with the way the data is stored in the DataFrame object, first of all since the data includes signs such as commas, and currency signs, its presented as a string format.
<i> I would like to remove any characters that do not represent number values and return these as intergers. </i>
End of explanation
income_df['Life Expectancy'] = income_df['Life Expectancy'].astype(int)
Explanation: The line above returns the desired result removing, the varchars from the cells and returning their values as intergers that can be computed and analayzed further.
End of explanation
income_df
Explanation: The line above repeats the same process for the 'Life Expectancy' Column and returns their values as intergers. The only diference is there is no replacement of varchars since the cells do not contain other than numberical characters.
End of explanation
income_df.plot(kind='area')
plt.show()
Explanation: What is returned after cells are cleaned and returned as computable data, is a clean DataFrame object.
End of explanation
income_df.plot(kind='bar', title='Income vs Life Expectancy')
plt.show() #bar graph
Explanation: <img src="incomearea1.png" alt="Income Area Graph">
This AREA graph doesnt do a great job at displaying the diference or similarities between Income VS Life Expectancy. This could be due to the colors or the choice of graph.
End of explanation
income_df.plot(x = 'Income / Person',y='Life Expectancy', kind='scatter')
plt.show() #scatter chart
Explanation: <img src="incomebar1.png" alt="Income Area Graph">
This bar chart does a good job of noting the diferences between income in measured countries, but does do well for representing their relationship to the Life Expectancy, alot of these values are not even visible.
End of explanation
plt.figure(figsize=(9, 6))
income_df = income_df.drop('Ethiopia')
income_df.plot(x='Income / Person', y='Life Expectancy', kind='bar', stacked=True)
plt.show()
Explanation: <img src="income_scatter.png" alt="Income Scatter Graph">
The Scatter plot above, does a great job of representing the diferences between the ages and Life Expectancy notably the diference between Incomes over 40k, which in relation to the diference between 20k and below 1k, are very simliar.
End of explanation
protein_df = pd.read_csv('HighProteinFoods.csv')
protein_df.stack()
Explanation: <img src="bar2income.png" alt="Income Bar Graph">
I think removing Ethiopia from the Data was crucial to understanding why the Income / Person has little effect, given the diference in Life Expectancy ranges between 40k, 19k, and 16k earners.
End of explanation
<END_TASK>