Returns a dictionary with data frames for candidates, parties and
committees
files = self.FILENAMES.get(year)
if not files: // it"s 2010, a different file architecture
return {
"candidates": self._data_by_pattern("Receitas", "candidato"),
"parties": self._data_by_pattern("Receitas", "partido"),
After Change
if key in data:
// strip columns names ("foobar " -> "foobar")
names = data[key].columns.values
cleaned_columns = {name: name.strip()for name in names}
data[key].rename(columns=cleaned_columns, inplace=True)
// normalize & translate
data[key].rename(columns=normalize_columns, inplace=True)