{"id":1787,"date":"2024-11-01T07:00:12","date_gmt":"2024-11-01T12:00:12","guid":{"rendered":"https:\/\/wollen.org\/blog\/?p=1787"},"modified":"2025-04-24T01:49:24","modified_gmt":"2025-04-24T06:49:24","slug":"celebrating-the-anomaly-of-jimmy-carter","status":"publish","type":"post","link":"https:\/\/wollen.org\/blog\/2024\/11\/celebrating-the-anomaly-of-jimmy-carter\/","title":{"rendered":"Celebrating the anomaly of Jimmy Carter"},"content":{"rendered":"<p>Former President Jimmy Carter recently turned 100 years old. Any American who becomes president has by definition lived an exceptional life, but Carter stands out among peers. While six presidents have lived into their 90s, including Carter, he&#8217;s now the first to conquer the century mark.<\/p>\n<p>Beyond that, Carter has spent nearly 44 years in retirement from the highest office\u2014a full decade longer than second place. That&#8217;s longer than Teddy Roosevelt and JFK had been alive at the time they were inaugurated (42.9 and 43.6 years respectively). Let&#8217;s take a look at presidential time in retirement.<\/p>\n<figure id=\"attachment_1803\" aria-describedby=\"caption-attachment-1803\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/carter_graduation.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1803 size-medium\" src=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/carter_graduation-300x238.jpeg\" alt=\"\" width=\"300\" height=\"238\" srcset=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/carter_graduation-300x238.jpeg 300w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/carter_graduation-1024x811.jpeg 1024w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/carter_graduation-768x608.jpeg 768w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/carter_graduation.jpeg 1364w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1803\" class=\"wp-caption-text\"><em>Carter with his fianc\u00e9e (left) and mother (right) at his US Naval Academy graduation, June 1946.<\/em><\/figcaption><\/figure>\n<hr \/>\n<h4>1. Prepare the data.<\/h4>\n<p>The dataset I use will be linked at the bottom of this post. It lists each president&#8217;s birth, death, inauguration date, and final day in office. We&#8217;ll use it to calculate time in retirement and then plot the results.<\/p>\n<p>First, load the data into a pandas DataFrame.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">import pandas as pd\r\n\r\ndf = pd.read_csv(\"potus_data.csv\", parse_dates=['birth', 'death', 'inauguration', 'leave_office'])<\/pre>\n<p>Many former presidents are still alive so we shouldn&#8217;t use a &#8220;death&#8221; column. We&#8217;ll be comparing time in retirement so let&#8217;s call the value a &#8220;high score.&#8221; And for those former presidents still here and celebrating with us, we can substitute today&#8217;s date.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">df.loc[:, 'high_score'] = df['death'].fillna(pd.Timestamp(\"November 1, 2024\"))<\/pre>\n<p>To calculate time in retirement, we can <code>apply<\/code> a lambda function. As a disclaimer, this approach isn&#8217;t technically 100% correct because there was no Leap Day in 1800 or 1900. The bottom line when dealing with units of years is that there is no perfect approach\u2014only a selection of incorrect methods to choose from, depending on your patience and need for precision. Dividing by 365.25 is usually good enough for me.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">df.loc[:, 'years_in_retirement'] = df.apply(lambda row: (row['high_score'] - row['leave_office']).days \/ 365.25, axis=1)<\/pre>\n<p>Sort the DataFrame by our new column to showcase Carter. Reset the index because we&#8217;ll use it in a moment to plot the data. Exclude zero values in the interest of good taste.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">df = df[df['years_in_retirement'] &gt; 0]\r\n\r\ndf = df.sort_values(\"years_in_retirement\", ascending=False).reset_index(drop=True)<\/pre>\n<p>Take a look at the data before we move on to Matplotlib. It&#8217;s fair to say that Carter has fought death to a draw.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">                    name leave_office high_score  years_in_retirement\r\n0           Jimmy Carter   1981-01-20 2024-10-29            43.772758\r\n1         Herbert Hoover   1933-03-04 1964-10-20            31.630390\r\n2            Gerald Ford   1977-01-20 2006-12-26            29.930185\r\n3      George H. W. Bush   1993-01-20 2018-11-30            25.859001\r\n4             John Adams   1801-03-04 1826-07-04            25.333333\r\n5           Bill Clinton   2001-01-20 2024-10-29            23.772758\r\n6       Martin Van Buren   1841-03-04 1862-07-24            21.388090\r\n7       Millard Fillmore   1853-03-04 1874-03-08            21.010267\r\n8        Harry S. Truman   1953-01-20 1972-12-26            19.931554\r\n9          Richard Nixon   1974-08-09 1994-04-22            19.701574\r\n10         James Madison   1817-03-04 1836-06-28            19.318275\r\n11     John Quincy Adams   1829-03-04 1848-02-23            18.973306\r\n12      Thomas Jefferson   1809-03-04 1826-07-04            17.333333\r\n13   William Howard Taft   1913-03-04 1930-03-08            17.010267\r\n14            John Tyler   1845-03-04 1862-01-18            16.876112\r\n15        George W. Bush   2009-01-20 2024-10-29            15.772758\r\n16         Ronald Reagan   1989-01-20 2004-06-05            15.373032\r\n17       Franklin Pierce   1857-03-04 1869-10-08            12.596851\r\n18   Rutherford B. Hayes   1881-03-04 1893-01-17            11.874059\r\n19      Grover Cleveland   1897-03-04 1908-06-24            11.304586\r\n20    Theodore Roosevelt   1909-03-04 1919-01-06             9.842574\r\n21      Ulysses S. Grant   1877-03-04 1885-07-23             8.386037\r\n22        Andrew Jackson   1837-03-04 1845-06-08             8.262834\r\n23  Dwight D. Eisenhower   1961-01-20 1969-03-28             8.183436\r\n24     Benjamin Harrison   1893-03-04 1901-03-13             8.021903\r\n25          Barack Obama   2017-01-20 2024-10-29             7.772758\r\n26        James Buchanan   1861-03-04 1868-06-01             7.244353\r\n27        Andrew Johnson   1869-03-04 1875-07-31             6.406571\r\n28          James Monroe   1825-03-04 1831-07-04             6.332649\r\n29     Lyndon B. Johnson   1969-01-20 1973-01-22             4.005476\r\n30       Calvin Coolidge   1929-03-04 1933-01-05             3.841205\r\n31          Donald Trump   2021-01-20 2024-10-29             3.772758\r\n32        Woodrow Wilson   1921-03-04 1924-02-03             2.918549\r\n33     George Washington   1797-03-04 1799-12-14             2.778919\r\n34     Chester A. Arthur   1885-03-04 1886-11-18             1.708419\r\n35         James K. Polk   1849-03-04 1849-06-15             0.281999<\/pre>\n<figure id=\"attachment_1794\" aria-describedby=\"caption-attachment-1794\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/hoover_jfk.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1794\" src=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/hoover_jfk-300x300.jpg\" alt=\"\" width=\"300\" height=\"300\" srcset=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/hoover_jfk-300x300.jpg 300w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/hoover_jfk-150x150.jpg 150w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/hoover_jfk-768x769.jpg 768w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/hoover_jfk-800x800.jpg 800w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/hoover_jfk.jpg 1000w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1794\" class=\"wp-caption-text\"><em>Former President Hoover meeting with President Kennedy, April 1961.<\/em><\/figcaption><\/figure>\n<hr \/>\n<h4>2. Plot the data.<\/h4>\n<p>We&#8217;re visualizing one-dimensional data so the obvious choice is a bar chart. But with (long) names along the independent axis, a horizontal bar chart will be easier to read.<\/p>\n<p>The code is straightforward. We use the DataFrame&#8217;s index as the independent variable and swap in president names for <code>yticklabels<\/code>. I chose to give Carter&#8217;s bar extra color to draw the viewer&#8217;s attention.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">import matplotlib.pyplot as plt\r\n\r\nplt.style.use(\"wollen_gray.mplstyle\")\r\nfig, ax = plt.subplots(figsize=(8, 12))\r\n\r\nax.barh(df.index, df['years_in_retirement'],\r\n        color=[\"#0270CF\" if name == \"Jimmy Carter\" else \"#888\" for name in df['name']],\r\n        height=0.6)\r\n\r\nax.set_yticks(df.index, labels=df['name'])\r\nax.set_ylim(-0.8, 35.8)\r\n\r\nax.set_xticks(range(0, 50, 5))\r\n\r\nax.set_title(\"US Presidents  \u2022  Years in Retirement  \u2022  Through November 1, 2024\")\r\n\r\nplt.savefig(\"potus_retirement.png\", dpi=150)<\/pre>\n<hr \/>\n<h4>3. The output.<\/h4>\n<p><a href=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/potus_retirement.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1809 size-large\" src=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/potus_retirement-683x1024.png\" alt=\"\" width=\"683\" height=\"1024\" srcset=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/potus_retirement-683x1024.png 683w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/potus_retirement-200x300.png 200w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/potus_retirement-768x1152.png 768w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/potus_retirement-1024x1536.png 1024w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/potus_retirement.png 1200w\" sizes=\"auto, (max-width: 683px) 100vw, 683px\" \/><\/a><\/p>\n<p>Clearly Carter knows something the rest of us do not! From Plains, Georgia to the White House to <a href=\"https:\/\/www.npr.org\/sections\/goatsandsoda\/2023\/02\/23\/1158358366\/jimmy-carter-took-on-the-awful-guinea-worm-when-no-one-else-would-and-he-triumph\" target=\"_blank\" rel=\"noopener\">eradicating the Guinea worm<\/a> and <a href=\"https:\/\/en.wikipedia.org\/wiki\/Jimmy_%26_Rosalynn_Carter_Work_Project\" target=\"_blank\" rel=\"noopener\">housing families who need a hand<\/a>, congratulations to him on a life well lived.<\/p>\n<figure id=\"attachment_2339\" aria-describedby=\"caption-attachment-2339\" style=\"width: 660px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/carter_1985.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2339 size-full\" src=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/carter_1985.jpg\" alt=\"\" width=\"660\" height=\"372\" srcset=\"https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/carter_1985.jpg 660w, https:\/\/wollen.org\/blog\/wp-content\/uploads\/2024\/11\/carter_1985-300x169.jpg 300w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/a><figcaption id=\"caption-attachment-2339\" class=\"wp-caption-text\">Carter with his wife, Rosalynn, and Willie Nelson in Plains, Georgia. May 1985. Photo credit: AP, Ric Feld.<\/figcaption><\/figure>\n<hr \/>\n<p><a href=\"https:\/\/wollen.org\/misc\/carter_2024.zip\"><strong>Download the data.<\/strong><\/a><\/p>\n<p><strong>Full code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">import pandas as pd\r\nimport matplotlib.pyplot as plt\r\n\r\n\r\ndf = pd.read_csv(\"potus_data.csv\", parse_dates=['birth', 'death', 'inauguration', 'leave_office'])\r\n\r\ndf.loc[:, 'high_score'] = df['death'].fillna(pd.Timestamp(\"November 1, 2024\"))\r\n\r\ndf.loc[:, 'years_in_retirement'] = df.apply(lambda row: (row['high_score'] - row['leave_office']).days \/ 365.25, axis=1)\r\n\r\ndf = df[df['years_in_retirement'] &gt; 0]\r\n\r\ndf = df.sort_values(\"years_in_retirement\", ascending=False).reset_index(drop=True)\r\n\r\nprint(df[['name', 'leave_office', 'high_score', 'years_in_retirement']])\r\n\r\nplt.style.use(\"wollen_gray.mplstyle\")\r\nfig, ax = plt.subplots(figsize=(8, 12))\r\n\r\nax.barh(df.index, df['years_in_retirement'],\r\n        color=[\"#0270CF\" if name == \"Jimmy Carter\" else \"#888\" for name in df['name']],\r\n        height=0.6)\r\n\r\nax.set_yticks(df.index, labels=df['name'])\r\nax.set_ylim(-0.8, 35.8)\r\n\r\nax.set_xticks(range(0, 50, 5))\r\n\r\nax.set_title(\"US Presidents  \u2022  Years in Retirement  \u2022  Through November 1, 2024\")\r\n\r\nplt.savefig(\"potus_retirement.png\", dpi=150)<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Former President Jimmy Carter recently turned 100 years old. Any American who becomes president has by definition lived an exceptional life, but Carter stands out among peers. While six presidents have lived into their 90s, including Carter, he&#8217;s now the<\/p>\n","protected":false},"author":1,"featured_media":1812,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[68,238],"tags":[348,319,160,347,344,135,22,122,350,242,343,346,345,24,126,30,349,46,187,337,25],"class_list":["post-1787","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-history","category-government","tag-348","tag-bar","tag-barh","tag-birthday","tag-carter","tag-csv","tag-data","tag-dataset","tag-georgia","tag-government","tag-hbar","tag-herbert-hoover","tag-jimmy-carter","tag-matplotlib","tag-mplstyle","tag-pandas","tag-plains","tag-plot","tag-politics","tag-president","tag-python"],"_links":{"self":[{"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/posts\/1787","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/comments?post=1787"}],"version-history":[{"count":24,"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/posts\/1787\/revisions"}],"predecessor-version":[{"id":2341,"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/posts\/1787\/revisions\/2341"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/media\/1812"}],"wp:attachment":[{"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/media?parent=1787"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/categories?post=1787"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wollen.org\/blog\/wp-json\/wp\/v2\/tags?post=1787"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}