我正在尝试将csv转换成一个.gexf格式的文件,用于动态gephi图形。其思想是在属性数据中包含所有的平行边(具有相同源和目标但后期日期不同的边)。在本例中,属性中的所有日期都与John在在线课程讨论区回答Jan问题的发布日期相对应。在
我怎样才能得到这样的csv:
Jan John 2012-04-07 2012-06-06
Jan Jason 2012-05-07 2012-06-06
Jan John 2012-03-02 2012-06-07
Jan Jason 2012-03-20 2012-06-08
Jan Jack 2012-03-26 2012-06-09
Jan Janet 2012-05-01 2012-06-10
Jan Jack 2012-05-04 2012-06-11
Jan Jason 2012-05-07 2012-06-12
Jan Jack 2012-05-09 2012-06-13
Jan John 2012-05-15 2012-06-14
Jan Janet 2012-05-15 2012-06-15
Jan Jason 2012-05-20 2012-06-16
Jan Jack 2012-05-23 2012-06-17
Jan Josh 2012-05-25 2012-06-18
Jan Jack 2012-05-28 2012-06-19
Jan Josh 2012-06-01 2012-06-20
格式如下:
^{pr2}$我尝试的方法效果不太好。我尝试创建两个列表,对于第一个列表中的每个条目,搜索第二个列表中前两个条目的匹配。如果有匹配项,那么我的脚本将删除第二个列表中的行并附加日期对。当每一行代表提问者和回答者之间的完全对应数量时,我将编写一个脚本将该行转换为边缘/属性数据。我一直在使用this as some sort of guide。在
看看Python pandas项目,它旨在简化这种操作。一个它如何分组和解析你的数据的例子。。。。在
剩下的就是用XML详细说明这些print语句,并可能输出到一个文件而不是打印。在
相关问题 更多 >
编程相关推荐