pyaddepar
pyaddepar copied to clipboard
Importing transactions
Something goes wrong when we try to import transactions. For each transaction we have made we get one column in the resulting table, e.g. Tag 1, Tag 2, ... Those columns are very sparse. Tag 221 points to Import 5309 - 05/19/2016. Maybe you could have one column called Tag.
def transactions(self, start=None, end=None):
end = end or pd.Timestamp("today")
start = start or pd.Timestamp("1900-01-01")
params = {"start_date": self.__format(start), "end_date": self.__format(end)}
p = parse(self.__request("transactions", params=params), dates=["Posted Date", "Date"],
index=["Owner ID", "Owned ID", "Date", "Transaction ID"])
# todo: THIS HAS TO GO!!!!!! The construction is weird
columns = [a for a in p.keys() if a.startswith("Tag")]
p["Tag"] = p[columns].sum(axis=1)
return p.drop(labels=columns, axis=1)
@tschm since a transaction can have multiple tags, any suggestions on how would you represent that in a single column of a CSV?
I guess CSV has to go at some point :-1: For now you could use "a,b" or a;b. Currently we have a total tag explosion. In particular it's good to have the tags in one column as it will simplify the search for certain tags?
This sounds like a bug to me. At the very least, tags that aren't applicable shouldn't cause empty columns to appear in the export.