How to display date in one line?

145 Views Asked by At

I have a minor problem with viewing one variable in a table. I changed data type of "date" from object to datetime64, but now it is displayed on 2 lines.

enter image description here

enter image description here

This is the code I used.

df['date']=pd.to_datetime(df["date"])

Is there a way to make it work on one line?

I tried to widen the "date" column, by setting up the maximum width.

pd.set_option('max_colwidth', None)
1

There are 1 best solutions below

0
Thomas On

I think you are asking why the dash breaks the line. In order to force a non-breaking hyphen, replace the normal "-" with this HTML entity:

‑

That is also displayed as a hyphen, but it will not cause a line break.