str(recent_prices.loc[0,[“itemPrice”]] これをhtmlで表示したい

str(recent_prices.loc[0,["itemPrice"]]) を HTML で表示するには、それを適切な HTML タグでくくる必要があります。Django テンプレートを使用しているようですので、以下のように表示することができます。

html
<p>{{ recent_prices.loc.0.itemPrice }}</p>

または、もし recent_prices.loc[0,["itemPrice"]] が DataFrame の場合、次のようにして値を取得して表示できます。

html
<p>{{ recent_prices.loc.0.itemPrice|default:"N/A" }}</p>

このコードでは、itemPrice が存在する場合はその値を表示し、存在しない場合は “N/A" と表示します。

未分類

Posted by ぼっち