0

can anyone explain why:

bal_sheet.style.format('${:,.2f}')

in jupyter notebooks generates a nicely formatted print out of the dataframe, but generates a AttributeError: 'DataFrame' object has no attribute 'format' in pycharm?

related question suggests identifying each row and column you want to format.

is there a way to format the entire dataframe without listing the indices?

i tried using:

print(f'{bal_sheet:.2f}')

but got TypeError: unsupported format string passed to DataFrame.format error message.

how do you format the printout of a dataframe?

Sydney
  • 31
  • 2
  • Where do you see that it says to list the rows and columns? Doing `pd.options.display.float_format = '${:,.2f}'.format` affects the whole dataframe... – Tomerikoo Nov 29 '22 at 16:44
  • i used pd.options.display.float_format = '${:,.2f}'.format and got back: ProForma ... per_54 CashBal 73844.723805042 ... $1,197,770.69 Accts Rec. Balance $0.00 ... $49,337.79 Inventory $15,000.00 ... $59,536.73 and Owners Equity 103486.72380504198 ... 103486.72380504198. don't understand why first column of Cash and all columns of Owner's equity aren't formatted. – Sydney Dec 01 '22 at 23:44
  • Maybe the data there is actually string and not float? – Tomerikoo Dec 03 '22 at 23:11

0 Answers0