0

I use Pandas for data analysis and want to produce a spreadsheet where cells have text with different color or with different font weight, for example: "this is bold and important, this is not". In a terminal, I can add these control characters before text and change the color and weight of the text after:

BOLD  = "\033[;1m"
BLUE  = "\033[1;34m"
CYAN  = "\033[1;36m"
UNDERLINE = '\033[4m'

and go back to normal with:

RESET = "\033[0;0m"

I know I can color cells and control the style of a whole cell, but I would like to control font inside a cell.

Is that possible?

miguelmorin
  • 5,025
  • 4
  • 29
  • 64
  • 2
    IMO, use `openpyxl` or `xlsxwriter` directly here. – BigBen Jun 15 '23 at 13:04
  • 1
    Does this answer your question? [How to change the font-size of text in dataframe using pandas](https://stackoverflow.com/questions/59284208/how-to-change-the-font-size-of-text-in-dataframe-using-pandas) – Laurent Jun 17 '23 at 13:34
  • @Laurent I read that thread and it sets the style for a cell or the whole dataframe, when I need to set it inside a cell, e.g. "something innocuous, __something relevant__". – miguelmorin Jun 26 '23 at 14:44

0 Answers0