Write a python code using pandas for this following problem and do not forgot to add comments in your code.
Suppose you have a text file called “President.txt” (which is shown below), you have to import this text file in code and using the data of this file, you have to create a new file called “NewPreFile.txt” where you will only show the only selected data of old “president.txt” file. In “NewPreFile.txt” file you need to show the presidents name, took office, left office, and party, of year 1961 to year 2013. In this new file you have create header keys like (presidents name, took office, left office, and party).
New file "NewPreFile.txt" look like, For example :
Presidents took office left office party
John F. Kenndy 20/01/1961 22/11/1963 Democratic
‘’ ‘’ ‘’ ‘’’ ‘’’
The data below shown for “president.txt” file. You have to copy this data and save as “president.txt” in your computer.
Presidency ,President ,Wikipedia Entry,Took office ,Left office ,Party ,Portrait,Thumbnail,Home State
1,George Washington,http://en.wikipedia.org/wiki/George_Washington,30/04/1789,4/03/1797,Independent ,GeorgeWashington.jpg,thmb_GeorgeWashington.jpg,Virginia
2,John Adams,http://en.wikipedia.org/wiki/John_Adams,4/03/1797,4/03/1801,Federalist ,JohnAdams.jpg,thmb_JohnAdams.jpg,Massachusetts
3,Thomas Jefferson,http://en.wikipedia.org/wiki/Thomas_Jefferson,4/03/1801,4/03/1809,Democratic-Republican ,Thomasjefferson.gif,thmb_Thomasjefferson.gif,Virginia
4,James Madison,http://en.wikipedia.org/wiki/James_Madison,4/03/1809,4/03/1817,Democratic-Republican ,JamesMadison.gif,thmb_JamesMadison.gif,Virginia
5,James Monroe,http://en.wikipedia.org/wiki/James_Monroe,4/03/1817,4/03/1825,Democratic-Republican ,JamesMonroe.gif,thmb_JamesMonroe.gif,Virginia
6,John Quincy Adams,http://en.wikipedia.org/wiki/John_Quincy_Adams,4/03/1825,4/03/1829,Democratic-Republican/National Republican ,JohnQuincyAdams.gif,thmb_JohnQuincyAdams.gif,Massachusetts
7,Andrew Jackson,http://en.wikipedia.org/wiki/Andrew_Jackson,4/03/1829,4/03/1837,Democratic ,Andrew_jackson_head.gif,thmb_Andrew_jackson_head.gif,Tennessee
8,Martin Van Buren,http://en.wikipedia.org/wiki/Martin_Van_Buren,4/03/1837,4/03/1841,Democratic ,MartinVanBuren.gif,thmb_MartinVanBuren.gif,New York
9,William Henry Harrison,http://en.wikipedia.org/wiki/William_Henry_Harrison,4/03/1841,4/04/1841,Whig,WilliamHenryHarrison.gif,thmb_WilliamHenryHarrison.gif,Ohio
10,John Tyler,http://en.wikipedia.org/wiki/John_Tyler,4/04/1841,4/03/1845,Whig,JohnTyler.jpg,thmb_JohnTyler.jpg,Virginia
11,James K. Polk,http://en.wikipedia.org/wiki/James_K._Polk,4/03/1845,4/03/1849,Democratic ,JamesKPolk.gif,thmb_JamesKPolk.gif,Tennessee
12,Zachary Taylor,http://en.wikipedia.org/wiki/Zachary_Taylor,4/03/1849,9/07/1850,Whig,ZacharyTaylor.jpg,thmb_ZacharyTaylor.jpg,Louisiana
13,Millard Fillmore,http://en.wikipedia.org/wiki/Millard_Fillmore,9/07/1850,4/03/1853,Whig,MillardFillmore.png,thmb_MillardFillmore.png,New York
14,Franklin Pierce,http://en.wikipedia.org/wiki/Franklin_Pierce,4/03/1853,4/03/1857,Democratic ,FranklinPierce.gif,thmb_FranklinPierce.gif,New Hampshire
15,James Buchanan,http://en.wikipedia.org/wiki/James_Buchanan,4/03/1857,4/03/1861,Democratic ,JamesBuchanan.gif,thmb_JamesBuchanan.gif,Pennsylvania
16,Abraham Lincoln,http://en.wikipedia.org/wiki/Abraham_Lincoln,4/03/1861,15/04/1865,Republican/National Union,AbrahamLincoln.jpg,thmb_AbrahamLincoln.jpg,Illinois
17,Andrew Johnson,http://en.wikipedia.org/wiki/Andrew_Johnson,15/04/1865,4/03/1869,Democratic/National Union,AndrewJohnson.gif,thmb_AndrewJohnson.gif,Tennessee
18,Ulysses S. Grant,http://en.wikipedia.org/wiki/Ulysses_S._Grant,4/03/1869,4/03/1877,Republican ,UlyssesSGrant.gif,thmb_UlyssesSGrant.gif,Ohio
19,Rutherford B. Hayes,http://en.wikipedia.org/wiki/Rutherford_B._Hayes,4/03/1877,4/03/1881,Republican ,RutherfordBHayes.png,thmb_RutherfordBHayes.png,Ohio
20,James A. Garfield,http://en.wikipedia.org/wiki/James_A._Garfield,4/03/1881,19/09/1881,Republican ,James_Garfield.jpg,thmb_James_Garfield.jpg,Ohio
21,Chester A. Arthur,http://en.wikipedia.org/wiki/Chester_A._Arthur,19/09/1881,4/03/1885,Republican ,ChesterAArthur.gif,thmb_ChesterAArthur.gif,New York
22,Grover Cleveland,http://en.wikipedia.org/wiki/Grover_Cleveland,4/03/1885,4/03/1889,Democratic ,Grover_Cleveland_2.jpg,thmb_Grover_Cleveland_2.jpg,New York
23,Benjamin Harrison,http://en.wikipedia.org/wiki/Benjamin_Harrison,4/03/1889,4/03/1893,Republican ,BenjaminHarrison.gif,thmb_BenjaminHarrison.gif,Indiana
24,Grover Cleveland,http://en.wikipedia.org/wiki/Grover_Cleveland,4/03/1893,4/03/1897,Democratic ,Grover_Cleveland.jpg,thmb_Grover_Cleveland.jpg,New York
25,William McKinley,http://en.wikipedia.org/wiki/William_McKinley,4/03/1897,14/9/1901,Republican ,WilliamMcKinley.gif,thmb_WilliamMcKinley.gif,Ohio
26,Theodore Roosevelt,http://en.wikipedia.org/wiki/Theodore_Roosevelt,14/9/1901,4/3/1909,Republican ,TheodoreRoosevelt.jpg,thmb_TheodoreRoosevelt.jpg,New York
27,William Howard Taft,http://en.wikipedia.org/wiki/William_Howard_Taft,4/3/1909,4/03/1913,Republican ,WilliamHowardTaft.jpg,thmb_WilliamHowardTaft.jpg,Ohio
28,Woodrow Wilson,http://en.wikipedia.org/wiki/Woodrow_Wilson,4/03/1913,4/03/1921,Democratic ,WoodrowWilson.gif,thmb_WoodrowWilson.gif,New Jersey
29,Warren G. Harding,http://en.wikipedia.org/wiki/Warren_G._Harding,4/03/1921,2/8/1923,Republican ,WarrenGHarding.gif,thmb_WarrenGHarding.gif,Ohio
30,Calvin Coolidge,http://en.wikipedia.org/wiki/Calvin_Coolidge,2/8/1923,4/03/1929,Republican ,CoolidgeWHPortrait.gif,thmb_CoolidgeWHPortrait.gif,Massachusetts
31,Herbert Hoover,http://en.wikipedia.org/wiki/Herbert_Hoover,4/03/1929,4/03/1933,Republican ,HerbertHover.gif,thmb_HerbertHover.gif,Iowa
32,Franklin D. Roosevelt,http://en.wikipedia.org/wiki/Franklin_D._Roosevelt,4/03/1933,12/4/1945,Democratic,FranklinDRoosevelt.gif,thmb_FranklinDRoosevelt.gif,New York
33,Harry S. Truman,http://en.wikipedia.org/wiki/Harry_S._Truman,12/4/1945,20/01/1953,Democratic,HarryTruman.jpg,thmb_HarryTruman.jpg,Missouri
34,Dwight D. Eisenhower,http://en.wikipedia.org/wiki/Dwight_D._Eisenhower,20/01/1953,20/01/1961,Republican ,Dwight_D_Eisenhower.jpg,thmb_Dwight_D_Eisenhower.jpg,Texas
35,John F. Kennedy,http://en.wikipedia.org/wiki/John_F._Kennedy,20/01/1961,22/11/1963,Democratic,John_F_Kennedy.jpg,thmb_John_F_Kennedy.jpg,Massachusetts
36,Lyndon B. Johnson,http://en.wikipedia.org/wiki/Lyndon_B._Johnson,22/11/1963,20/1/1969,Democratic,Lyndon_B_Johnson.gif,thmb_Lyndon_B_Johnson.gif,Texas
37,Richard Nixon,http://en.wikipedia.org/wiki/Richard_Nixon,20/1/1969,9/8/1974,Republican,RichardNixon.gif,thmb_RichardNixon.gif,California
38,Gerald Ford,http://en.wikipedia.org/wiki/Gerald_Ford,9/8/1974,20/01/1977,Republican,Gerald_R_Ford.jpg,thmb_Gerald_R_Ford.jpg,Michigan
39,Jimmy Carter,http://en.wikipedia.org/wiki/Jimmy_Carter,20/01/1977,20/01/1981,Democratic ,James_E_Carter.gif,thmb_James_E_Carter.gif,Georgia
40,Ronald Reagan,http://en.wikipedia.org/wiki/Ronald_Reagan,20/01/1981,20/01/1989,Republican ,ReaganWH.jpg,thmb_ReaganWH.jpg,California
41,George H. W. Bush,http://en.wikipedia.org/wiki/George_H._W._Bush,20/01/1989,20/01/1993,Republican ,George_H_W_Bush.gif,thmb_George_H_W_Bush.gif,Texas
42,Bill Clinton,http://en.wikipedia.org/wiki/Bill_Clinton,20/01/1993,20/01/2001,Democratic ,Clinton.jpg,thmb_Clinton.jpg,Arkansas
43,George W. Bush,http://en.wikipedia.org/wiki/George_W._Bush,20/01/2001,20/01/2009,Republican ,George_W_Bush.jpg,thmb_George_W_Bush.jpg,Texas
44,Barack Obama,http://en.wikipedia.org/wiki/Barack_Obama,20/01/2009,Incumbent , Democratic ,Barack_Obama.jpg,thmb_Barack_Obama.jpg,Illinois
Output file:- NewPreFile.txt
President Took office Left office
Party
George Washington 30/04/1789
4/03/1797 Independent
John Adams 4/03/1797 4/03/1801
Federalist
Thomas Jefferson 4/03/1801
4/03/1809 Democratic-Republican
James Madison 4/03/1809
4/03/1817 Democratic-Republican
James Monroe 4/03/1817
4/03/1825 Democratic-Republican
John Quincy Adams 4/03/1825
4/03/1829 Democratic-Republican/National
Republican
Andrew Jackson 4/03/1829
4/03/1837 Democratic
Martin Van Buren 4/03/1837
4/03/1841 Democratic
William Henry Harrison 4/03/1841
4/04/1841 Whig
John Tyler 4/04/1841 4/03/1845
Whig
James K. Polk 4/03/1845
4/03/1849 Democratic
Zachary Taylor 4/03/1849
9/07/1850 Whig
Millard Fillmore 9/07/1850
4/03/1853 Whig
Franklin Pierce 4/03/1853
4/03/1857 Democratic
James Buchanan 4/03/1857
4/03/1861 Democratic
Abraham Lincoln 4/03/1861
15/04/1865 Republican/National Union
Andrew Johnson 15/04/1865
4/03/1869 Democratic/National Union
Ulysses S. Grant 4/03/1869
4/03/1877 Republican
Rutherford B. Hayes 4/03/1877
4/03/1881 Republican
James A. Garfield 4/03/1881
19/09/1881 Republican
Chester A. Arthur 19/09/1881
4/03/1885 Republican
Grover Cleveland 4/03/1885
4/03/1889 Democratic
Benjamin Harrison 4/03/1889
4/03/1893 Republican
Grover Cleveland 4/03/1893
4/03/1897 Democratic
William McKinley 4/03/1897
14/9/1901 Republican
Theodore Roosevelt 14/9/1901
4/3/1909 Republican
William Howard Taft 4/3/1909
4/03/1913 Republican
Woodrow Wilson 4/03/1913
4/03/1921 Democratic
Warren G. Harding 4/03/1921
2/8/1923 Republican
Calvin Coolidge 2/8/1923
4/03/1929 Republican
Herbert Hoover 4/03/1929
4/03/1933 Republican
Franklin D. Roosevelt 4/03/1933
12/4/1945 Democratic
Harry S. Truman 12/4/1945
20/01/1953 Democratic
Dwight D. Eisenhower 20/01/1953
20/01/1961 Republican
John F. Kennedy 20/01/1961
22/11/1963 Democratic
Lyndon B. Johnson 22/11/1963
20/1/1969 Democratic
Richard Nixon 20/1/1969
9/8/1974 Republican
Gerald Ford 9/8/1974 20/01/1977
Republican
Jimmy Carter 20/01/1977
20/01/1981 Democratic
Ronald Reagan 20/01/1981
20/01/1989 Republican
George H. W. Bush 20/01/1989
20/01/1993 Republican
Bill Clinton 20/01/1993
20/01/2001 Democratic
George W. Bush 20/01/2001
20/01/2009 Republican
Barack Obama 20/01/2009 Incumbent
Democratic
Write a python code using pandas for this following problem and do not forgot to add comments in ...
Go back to the Statehood sheet. Add a column E called Nicknames. Use a VLOOKUP() function to add the nicknames from the nicknames sheet into column E of the statehood sheet. plz just give me the vlookup function to type in State # nicknames State Delaware Pennsylvania New Jersey Georgia Connecticut Massachusetts Maryland South Carolina New Hampshire Virginia New York North Carolina Rhode Island Vermont Kentucky Tennessee Ohio Louisiana Indiana Mississippi Illinois Alabama Maine Missouri Arkansas Michigan Florida Texas lowa...
Go back to the Statehood sheet. Add a column E called Nicknames. Use a VLOOKUP() function to add the nicknames from the nicknames sheet into column E of the statehood sheet. Please just give the vlookup function to type in State # nicknames State Delaware Pennsylvania New Jersey Georgia Connecticut Massachusetts Maryland South Carolina New Hampshire Virginia New York North Carolina Rhode Island Vermont Kentucky Tennessee Ohio Louisiana Indiana Mississippi Illinois Alabama Maine Missouri Arkansas Michigan Florida Texas lowa Wisconsin...
I am trying to do this assignment: Write a program that reads a list of concepts/strings from the LIST.txt text file (one concept per line), stores them into an array of strings, and then prints the following: 1.Prints a heading “LIST1:” and then prints all the concepts from the array, one concept per line 2.Prints a heading “LIST2:” and then prints all the concepts from the array that do not contain spaces, one concept per line 3.Prints a heading “LIST3:”...
JAVA Create a Governor class with the following attributes: name : String party - char (the character will be either D, R or I) ageWhenElected : int Create a State class with the following attributes: name : String abbreviation : String population : long governor : Governor Your classes will have all setters, getters, typical methods to this point (equals(), toString()) and at least 3 constructors (1 must be the default, 1 must be the copy). You will be turning...
ules for submission: 1. All problems must be solved using SQL code. The SQL code and the output of your query should be cut and pasted into your MS Word file. a. Output Tables must be screenshot from DBMS b. Do not create a MS Word (or other application) table and paste the results into it. c. With the exception of Problems 4, 5 and 6, all output should be the result of a single step. Do not paste outputs...
Question 1. (Minitab or R) The Environmental Protection Agency (EPA) tracks the management of certain toxic chemicals that may pose a threat to human health and the environment. U.S. facilities in different industry sectors must report annually how much of each chemical is released to the environment and/or managed through recycling, energy recovery and treatment. (A "release" of a chemical means that it is emitted to the air or water, or placed in some type of land disposal.) The information...
3.26 c. Based on the histograms from Parts (a) and (b). write a few sentences commenting on the simi- larities and differences in the distribution of SAT critical reading scores formales and females Relative Frequency for Females 43.4 Country Australia Austria Canada Colombia Costa Rica Czech Republic Denmark Finland France Germany Greece Hungary Iceland Israel Percentage of people age 25 to 34 with 4.sear degree 49.3 39.7 60.6 28.1 28.9 32.6 45.9 41.1 44.0 30.5 41.0 30.4 43.3 47.4 Percentage...
Please write answers clear. I will leave like if its correct. State POVERTY% GUN DEATHS H.S. GRAD's UNEMPLOYMENT New Jersey 6.80% 5.7 91.8 91.8 Vermont 7.60% 9.2 91 3.6 91 3.6 Minnesota 8.10% 12 91.5 4 Hawaii 8.60% 2.6 87.4 4.9 Delaware 9.20% 10.3 90.4 3.7 Utah 9.20% 12.6 90.4 3.7 Virginia 9.20% 10.2 86.6 4.5 Nebraska 9.50% 9 89.8 2.8 connecticut 9.70% 4.4 88.6 5.3 Maryland 9.70% 9.7 88.2 5.1 Idaho Alaska 9.90% 10.00% 14.1 17.6 88.4 91.4 4.2...
Create SQL statements based on the given tables: Code to create the tables: CREATE DATABASE LAB4DB; USE LAB4DB; CREATE TABLE CUSTOMER ( CUS_CODE int primary key, CUS_LNAME varchar(15), CUS_FNAME varchar(15), CUS_INITIAL varchar(1), CUS_AREACODE varchar(3), CUS_PHONE varchar(8), CUS_BALANCE float(8) ); INSERT INTO CUSTOMER VALUES('10010','Ramas','Alfred','A','615','844-2573','0'); INSERT INTO CUSTOMER VALUES('10011','Dunne','Leona','K','713','894-1238','0'); INSERT INTO CUSTOMER VALUES('10012','Smith','Kathy','W','615','894-2285','345.86'); INSERT INTO CUSTOMER VALUES('10013','Olowski','Paul','F','615','894-2180','536.75'); INSERT INTO CUSTOMER VALUES('10014','Orlando','Myron','','615','222-1672','0'); INSERT INTO CUSTOMER VALUES('10015','O''Brian','Amy','B','713','442-3381','0'); INSERT INTO CUSTOMER VALUES('10016','Brown','James','G','615','297-1228','221.19'); INSERT INTO CUSTOMER VALUES('10017','Williams','George','','615','290-2556','768.93'); INSERT INTO CUSTOMER VALUES('10018','Farriss','Anne','G','713','382-7185','216.55'); INSERT INTO CUSTOMER VALUES('10019','Smith','Olette','K','615','297-3809','0'); /*...
26. (For this question use the data file Per Capita Link). A researcher interested in examining how a state's per capita income may be affected by the percent of the state's adult population that has not completed high school and the percent of the state's population that is foreign bom. part a: Write down an appropriate model for this researcher to estimate. Clearly identify what is the response variable and what are the explanatory variables. part b: Using regression analysis,...