Commit 52ec86a4 authored by Hans van den Heuvel's avatar Hans van den Heuvel
Browse files

Made preparations for better reporting code.

parent e7dfcb81
......@@ -220,10 +220,10 @@ if dataset.food_composition.sheet is not None:
fcs = dataset.food_composition.sheet[(
dataset.food_composition.sheet['idToFood'].str.startswith('P') &
dataset.food_composition.sheet['idFromFood'].str.contains('-'))]
fcs[(fcs['idToFood'].str.startswith('P') & fcs['idFromFood'].str.contains('-'))].assign()
fcs=fcs.mcra.splitjoin(name='idToFood-PC', split='idFromFood', join='idToFood')
# Finally a left join to combine
fcs = fcs.mcra.splitjoin(
name='idToFood-PC', split='idFromFood', join='idToFood')
# Then a left join to combine
efsa_combined = efsa_combined.merge(
# Left join with processing type sheet,
fcs,
......
......@@ -63,15 +63,11 @@ class McraAccessor:
else:
df[split] = self._obj[split].str.rsplit(split_sep, n=1).str[0]
df[name]= df.loc[:, (join, split)].apply(
df[name] = df.loc[:, (join, split)].apply(
lambda x: '-'.join(x.dropna()), axis=1)
df=df.drop([join,split],axis=1)
#self._obj[name] = df.loc[:, (name)]
##self._obj[name] = df[name]
self._obj=self._obj.merge(df, left_index=True, right_index=True)
#self._obj.loc[name] = df[name]
print(self._obj)
df = df.drop([join, split], axis=1)
# Not ideal yet, but slightly better than it used to be....
self._obj = self._obj.merge(df, left_index=True, right_index=True)
return self._obj
......@@ -224,7 +220,7 @@ class DataSheet:
' * File size: {size_str} ({size} B)'.format(
size_str=self.file.size_string, size=self.file.size))
self.add_reportline(
' * Hash: {hash})'.format(hash=self.file.hash))
' * Hash: {hash}'.format(hash=self.file.hash))
self.report = self.report+temp
def update_properties(self):
......@@ -491,3 +487,10 @@ class DataSet:
else:
dataset.type = 'pandas'
dataset.update_properties()
def close(self):
'''
Method to close the dataset.
Most importantly save files.
'''
pass
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment