将多个值列转换为新的键值对

我需要转换.csv文件的内容

continent, region, country, 1990, 1991, 1992, 1993, ... Africa, East Africa, Ethiopia, 12, 14, 15, 9, ... 

至:

 continent, region, country, year, value Africa, East Africa, Ethiopia, 1990, 12 Africa, East Africa, Ethiopia, 1991, 14 Africa, East Africa, Ethiopia, 1992, 15 Africa, East Africa, Ethiopia, 1993, 9 ... 

有一堆行,所以这是不可能的。 我知道有一个办法可以做,我真的只是有问题甚至解释我在做什么。 它本质上是转换桌子的一部分,但不是全部。

编辑:这是一个完整的数据行的示例:

 continent, region, country, country_abbr, economy, lat, long, 1990/91, 1991/92, 1992/93, 1993/94, 1994/95, 1995/96, 1996/97, 1997/98, 1998/99, 1999/00, 2000/01, 2001/02, 2002/03, 2003/04, 2004/05, 2005/06, 2006/07, 2007/08, 2008/09, 2009/10, 2010/11, 2011/12, 2012/13, 2013/14, 2014/15 Africa, Middle Africa, Angola, AO, 7. Least developed region, -12.5, 18.5, 50, 79, 78, 33, 77, 62, 71, 64, 85, 55, 50, 21, 57, 38, 15, 25, 35, 36, 38, 13, 35, 29, 33, 35, 39 

不太清楚你的意思是什么这些话在技术上还不存在,所以我刚刚在第一年专栏之前就把country专栏移到了这个位置,而现在却忽略了country的左边的任何东西。 'Unpivot', 这里详细描述,selectcountry列到上一年的列,并且只填充许多行。

由此产生的表应该是三列,每个国家有一组25行。 第一列(“行” – 国名)可能被用来查找我在上面忽略的细节。