Skip to content
Snippets Groups Projects
Commit 1bbdb0e9 authored by Alice Brenon's avatar Alice Brenon
Browse files

Add a default TSV reader in GEODE module

parent 6af016b8
No related branches found
No related tags found
No related merge requests found
from GEODE.Classification import discursiveFunctions
from GEODE.Metadata import article, paragraph, fromKey, relativePath, toKey, uid
from GEODE.store import corpus, Directory, SelfContained, toTSV
from GEODE.store import corpus, Directory, fromTSV, SelfContained, toTSV
from GEODE.Visualisation import heatmap
from GEODE.Metadata import fromKey, relativePath
from GEODE.store.TSV import toTSV
from GEODE.store.TSV import fromTSV, toTSV
import pandas
from os import makedirs
from os.path import dirname, isdir
......@@ -37,7 +37,7 @@ class TSVIndexed(Corpus):
def load(self):
if self.data is None:
self.data = pandas.read_csv(self.tsv_path, sep='\t')
self.data = fromTSV(self.tsv_path)
self.detect_keys()
self.data = self.data.set_index(self.keys, drop=False)
......
......@@ -22,3 +22,6 @@ def toTSV(filePath, data, sortBy='toStrKey'):
else:
sortedData = data.sort_index(key=forPanda(data, sortBy))
sortedData.to_csv(filePath, sep='\t', index=False)
def fromTSV(filePath):
return pandas.read_csv(filePath, sep='\t')
from GEODE.store.Corpus import corpus, Directory, SelfContained
from GEODE.store.TSV import toTSV
from GEODE.store.TSV import fromTSV, toTSV
import os
import os.path
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment