I have two lists. I would like to concatenate in order to get a list of strings. The first list is composed of strings The second list is composed of a Timestamp.
I would concatenate as follow in one line with a list of comprehension.
#just for creating something similar to my actual situation
import pandas as pd
quarter=["First Quarter","Second Quarter","Third Quarter","Fourth Quarter"]
quarter_forecast_day=pd.date_range(start="12/15/2020",periods=4)
I would like something like that:
str(quarter[x]+'\n'+quarter_forecast[y].strftime("%d/%m/%Y"))
What I tried:
#quarter_label=[str(quarter[x]+'\n'+y.strftime("%d/%m/%Y")) for x,y in [quarter, quarter_forecast_day]]
#too many values to unpack (expected 2)
#quarter_label=[str(quarter[x]+'\n'+y.strftime("%d/%m/%Y")) for x,y in (quarter, quarter_forecast_day)]
#too many values to unpack (expected 2)
#quarter_label=[str(quarter[x]+'\n'+y.strftime("%d/%m/%Y")) for x,y in quarter, quarter_forecast_day]
#invalid sintax
#quarter_label=[lambda x,y:str(quarter[x]+'\n'+y.strftime("%d/%m/%Y") for x,y in [quarter, quarter_forecast]]
#invalid sintax
quarter_label=[lambda x,y:str(quarter[x]+'\n'+y.strftime("%d/%m/%Y") for x,y in (quarter, quarter_forecast)]
#invalid sintax
Before asking I read this question, this one and this one. But I am still struggling to find a proper way to apply it.