Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试转置一个包含大约 6000 行和 200 万列的巨大制表符分隔文件。最好的方法不应该涉及将整个文件保存在内存中,这似乎是这个问题的答案:
如何对csv表中的数据进行行到列的转置?
一种方法是为每一列迭代输入文件一次(未经测试的代码!):
with open("input") as f, open("output", "w") as g: try: for column_index in itertools.count(): f.seek(0) col = [line.split("\t")[column_index] for line in f] g.write("\t".join(col) + "\n") except IndexError: pass
这将非常慢,但一次只能在内存中保留一行。
Hi i am using YUI data table
initially i am loading table with no records(empty), i am taking the input from user and making an AJAX call which is returning J