Can someone confirm that this is a bug:
pd.options.display.chop_threshold = 0.5
pd.options.display.date_dayfirst = True
df = pd.DataFrame([[1.00, 0.1, 0.01, 0.001], [2.22, 2.22, 2.22, 2.22]],
index=pd.date_range(start="01-01-2000", periods=2))
print(df)
0 1 2 3
2000-01-01 1.00 0.00 0.00 0.00
2000-01-02 2.22 2.22 2.22 2.22
Also it seems weird to have the options display.date_dayfirst
and display.date_yearfirst
with both set to False
by default, and yet print year first..
Docs say: When True, prints and parses dates with the day first, eg 20/01/2005
. Maybe this is just for parsing?
Comment From: k4thir
Hi , I'm a beginner to open source and can I contribute on this ?
Comment From: attack68
@k4thir not really, because the error has not been triaged or discussed, so it is unclear what you should do. Instead trying searching for pandas issues with label:"good first issue"
and milestone contributions welcome
.
Comment From: JARVIS-03
Hi @attack68,
To set the date format for your dataframe index, you have to use strftime(format)
Please add the following line in your code to get the index date to start from the day
df.index = df.index.strftime('%d/%m/%Y') # 01/01/2000
Some of the Date format available,
df.index = df.index.strftime('%d/%m/%Y') # 01/01/2000 df.index = df.index.strftime('%m/%d/%Y') # 01/01/2000 df.index = df.index.strftime('%Y/%m/%d') # 2000/01/01
For more info, please go through the below link, https://docs.python.org/3/library/datetime.html
Comment From: attack68
Hi @JARVIS-03 The issue wasn't really about how to to it. It was more the non-effect of a pandas options which is documented to have an effect in this regard.
Comment From: mroeschke
I only see this explicitly called here
https://github.com/pandas-dev/pandas/blob/4e1f51cc1ce824ef9a542c83b956b3d7cc62d3d9/pandas/_libs/tslibs/parsing.pyx#L315-L319
So possibly the docs are incorrect. It's also concerning we don't have tests for these configurations.
Since it appears this is only for parsing, I think it's okay that both default to False
Comment From: harinik
take