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
No related branches found
No related tags found
1 merge request!9Check items before concatenating
...@@ -136,21 +136,25 @@ class shopping_client: ...@@ -136,21 +136,25 @@ class shopping_client:
def _basket_to_pandas(self): def _basket_to_pandas(self):
if len(self.connectors): if len(self.connectors):
converted_basket = {
connector.name: pd.concat( converted_basket = {}
[
for connector in self.connectors:
items = [
connector.basket_item_to_pandas(item) connector.basket_item_to_pandas(item)
for item in self.basket for item in self.basket
if connector.validate_basket_item(item) if connector.validate_basket_item(item)
], ]
axis=1,
) if len(items):
for connector in self.connectors converted_basket[connector.name] = pd.concat(items, axis=1)
}
return { return {
name: data.to_frame().T if data.ndim < 2 else data.T name: data.to_frame().T if data.ndim < 2 else data.T
for name, data in converted_basket.items() for name, data in converted_basket.items()
} }
warn( warn(
"No archive connectors specified - could not convert any basket items to Pandas DataFrame" "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