答案 0 :(得分:1)
df = pd.DataFrame({'UTC': [1480597215, 1480597215, 1480597215, 1480544735],
'Country': ['', np.nan, 'FR', 'RU']})
print (df)
Country UTC
0 1480597215
1 NaN 1480597215
2 FR 1480597215
3 RU 1480544735
df['UTC'] = pd.to_datetime(df['UTC'], unit='s', errors='coerce').dt.tz_localize('UTC')
mask = df['Country'].notnull() & (df['Country'] != '')
print (mask)
0 False
1 False
2 True
3 True
Name: Country, dtype: bool
df['tz'] = df[mask].apply(lambda x: x['UTC'].tz_convert(country_timezones(x['Country'])[0]),
axis=1)
print (df)
Country UTC tz
0 2016-12-01 13:00:15+00:00 NaN
1 NaN 2016-12-01 13:00:15+00:00 NaN
2 FR 2016-12-01 13:00:15+00:00 2016-12-01 14:00:15+01:00
3 RU 2016-11-30 22:25:35+00:00 2016-12-01 00:25:35+02:00

.product-container {
text-align: center;
float: left;
width: 250px;
height: 470px;
padding: 5px;
border: thin solid #999;
position: relative;
margin-left: 10px;
}
.product-description {
width: 100%;
text-transform: uppercase;
font-size: .8em;
padding: 10px 0px;
}
.product-price {
position: absolute;
bottom: 50px;
padding-top: 15px;
text-align: center;
width: 100%;
font-size: 1.2em;
font-weight: bold;
}
.add-to-cart {
position: absolute;
bottom: 5px;
text-align: center;
width: 100%;
padding-top: 15px;
}
button {
width: 100px;
height: 30px;
background-color: orange;
color: white;
border: none;
border-radius: 5%;
}

我创建了一个例子。我无法看到您的代码,因此我不得不做出一些假设。如果这对您有用,请告诉我。 小提琴:https://jsfiddle.net/beekvang/q30odku9/1/