熊猫造型无输出

时间:2019-06-16 05:16:44

标签: python pandas styling

我在数据框下方

  Trade Date Transaction No Account Mkt Security Name Stock Ticker Local CCY  Unit Price Trans Type  Qty  Net Amount (local)  Unrealised P&L (local)  Unrealised P&L (base)  Percent change
0 2018-01-03      1111111/1  246473  US     APPLE INC         AAPL       USD         154        Buy   15                2310                    -581                   -794             -25
1 2018-06-19      1111112/1  246473  US     APPLE INC         AAPL       USD         178        Buy   20                3560                    -294                   -401              -8
2 2017-06-19      1111113/1  246473  US     APPLE INC         AAPL       USD         140        Buy   25                3500                   -1318                  -1802             -37

我应用了以下熊猫样式:

stock_ticker_transactions_df.style.format({
                'Net Amount (local)': '{:,.2f}',
                'Unrealised P&L (local)': '{:,.2f}',
                'Unrealised P&L (base)': '{:,.2f}',
                'Percent change': '{:,.2%}',
            })

我不知道为什么输出如下:

Out[181]: <pandas.io.formats.style.Styler at 0x20c78f30438>

我以为输出将是:

  Trade Date Transaction No Account Mkt Security Name Stock Ticker Local CCY  Unit Price Trans Type  Qty     Net Amount (local)     Unrealised P&L (local)     Unrealised P&L (base)      Percent change
0 2018-01-03      1111111/1  246473  US     APPLE INC         AAPL       USD         154        Buy   15                2310.00                    -581.00                   -794.00             -25.00%
1 2018-06-19      1111112/1  246473  US     APPLE INC         AAPL       USD         178        Buy   20                3560.00                    -294.00                   -401.00              -8.00%
2 2017-06-19      1111113/1  246473  US     APPLE INC         AAPL       USD         140        Buy   25                3500.00                   -1318.00                  -1802.00             -37.00%

欣赏是否有人可以帮助我了解问题所在以及如何获得所需的输出?

感谢您抽出时间阅读我的问题并感谢您的帮助。

0 个答案:

没有答案