Skip to content
Snippets Groups Projects
Commit f64ce1a6 authored by Klaas Kliffen's avatar Klaas Kliffen :satellite:
Browse files

Check items before concatenating

parent cf058c49
Branches
No related tags found
1 merge request!9Check items before concatenating
......@@ -136,21 +136,25 @@ class shopping_client:
def _basket_to_pandas(self):
if len(self.connectors):
converted_basket = {
connector.name: pd.concat(
[
converted_basket = {}
for connector in self.connectors:
items = [
connector.basket_item_to_pandas(item)
for item in self.basket
if connector.validate_basket_item(item)
],
axis=1,
)
for connector in self.connectors
}
]
if len(items):
converted_basket[connector.name] = pd.concat(items, axis=1)
return {
name: data.to_frame().T if data.ndim < 2 else data.T
for name, data in converted_basket.items()
}
warn(
"No archive connectors specified - could not convert any basket items to Pandas DataFrame"
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment