Most Popular Baby Names in New York πŸ‘Ά

Most Popular Baby Names in New York πŸ‘Ά

From the Social Security Administration.

import pandas as pd
df = pd.read_csv('/home/andy/Desktop/NY.TXT',header=None)
pt=df.pivot_table(index=2, columns=3, aggfunc='sum').droplevel(0,axis=1).fillna(0)
z = pt.T
z=((z/z.sum())*100).fillna(0).T
z.idxmax(axis=1).to_csv('/home/andy/Desktop/mostpop.csv')

1910Mary1920John1940Robert1960Michael1980Michael2000Michael
1911Mary1921John1941Robert1961Michael1981Michael2001Michael
1912Mary1922John1942Robert1962Michael1982Michael2002Michael
1913Mary1923John1943Robert1963Michael1983Michael2003Michael
1914John1924John1944Robert1964John1984Michael2004Michael
1915Mary1925John1945Robert1965Michael1985Michael2005Michael
1916Mary1926John1946Robert1966Michael1986Michael2006Michael
1917John1927John1947Robert1967Michael1987Michael2007Michael
1918John1928John1948Robert1968Michael1988Michael2008Michael
1919John1929John1949Robert1969Michael1989Michael2009Michael
  1930John1950Robert1970Michael1990Michael2010Isabella
  1931Robert1951Robert1971Michael1991Michael2011Michael
  1932John1952Robert1972Michael1992Michael2012Sophia
  1933John1953Robert1973Michael1993Michael2013Sophia
  1934Robert1954Robert1974Michael1994Michael2014Jacob
  1935Robert1955Robert1975Michael1995Michael2015Liam
  1936Robert1956Michael1976Michael1996Michael2016Liam
  1937Robert1957Michael1977Michael1997Michael2017Liam
  1938Robert1958Michael1978Michael1998Michael2018Liam
  1939Robert1959John1979Michael1999Michael2019Liam
          2020Liam

Leave a Reply

Your email address will not be published. Required fields are marked *