【发布时间】:2016-08-17 06:45:18
【问题描述】:
我正在使用以下df:
c.sort_values('2005', ascending=False).head(3)
GeoName ComponentName IndustryId IndustryClassification Description 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014
37926 Alabama Real GDP by state 9 213 Support activities for mining 99 98 117 117 115 87 96 95 103 102 (NA)
37951 Alabama Real GDP by state 34 42 Wholesale trade 9898 10613 10952 11034 11075 9722 9765 9703 9600 9884 10199
37932 Alabama Real GDP by state 15 327 Nonmetallic mineral products manufacturing 980 968 940 1084 861 724 714 701 589 641 (NA)
我想对所有年份强制使用数字:
c['2014'] = pd.to_numeric(c['2014'], errors='coerce')
有没有简单的方法可以做到这一点,还是我必须全部输入?
【问题讨论】: