How to sort date index of a pandas dataframe so that all the newer year dates are on one side on the X-axis label when plotted on graphPandas timeseries plot setting x-axis major and minor ticks and labelsHow can I replace all the NaN values with Zero's in a column of a pandas dataframeHow to sort a dataFrame in python pandas by two or more columns?Constructing pandas DataFrame from values in variables gives “ValueError: If using all scalar values, you must pass an index”How to convert index of a pandas dataframe into a column?How to sort a Pandas DataFrame by index?Sort Pandas Dataframe by Datehow to sort pandas dataframe from one columnPlot pandas dataframe index formatted as Month-Year on x axisHow to plot pandas DataFrame with date (Year/Month)?
Implementation of the Jacobi Symbol in C
I calculated that we should be able to see the sun well beyond the observable universe. Where did I go wrong?
How is linear momentum conserved in circular motion?
Why there is a red color in right side?
Does there exist a non-trivial group that is both perfect and complete?
Why was New Asgard established at this place?
In a list with unique pairs A, B, how can I sort them so that the last B is the first A in the next pair?
Why is it 出差去 and not 去出差?
How to write a nice frame challenge?
What is the name of the person who reconciled a line from Rudram to dakshinamurthy and Adi Shankaracharya?
60's (or earlier) sci-fi short story about two spacecrafts exchanging plants for gold and thinking they got the better of the exchange
How can I take pictures like these examples with a yellowish tone and point & shoot film camera look?
How can I prevent a user from copying files on another hard drive?
Synaptic Static - when to roll the d6?
Why do you need to heat the pan before heating the olive oil?
Basic power tool set for Home repair and simple projects
How do I find which software is doing an SSH connection?
Would a 7805 5 V regulator drain a 9 V battery?
Why one uses 了 and the other one doesn’t?
In Street Fighter, what does the M stand for in M Bison?
How Hebrew Vowels Work
First occurrence in the Sixers sequence
How much steel armor can you wear and still be able to swim?
Definition of 'vrit'
How to sort date index of a pandas dataframe so that all the newer year dates are on one side on the X-axis label when plotted on graph
Pandas timeseries plot setting x-axis major and minor ticks and labelsHow can I replace all the NaN values with Zero's in a column of a pandas dataframeHow to sort a dataFrame in python pandas by two or more columns?Constructing pandas DataFrame from values in variables gives “ValueError: If using all scalar values, you must pass an index”How to convert index of a pandas dataframe into a column?How to sort a Pandas DataFrame by index?Sort Pandas Dataframe by Datehow to sort pandas dataframe from one columnPlot pandas dataframe index formatted as Month-Year on x axisHow to plot pandas DataFrame with date (Year/Month)?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a pandas dataframe with dates as the indexes (indices). When I plot the values, the indexes(dates, i.e. the X-axis labels) do not show up in a proper sequence on the X-axis of the plotted graph. For example, instead of all the 2018 dates (e.g. 2018/02/15, 2018/03/10, 2018/10/12 ... 2019/01/07, 2019/01/10, 2019/03/16 ...), I would have these dates showing up on the X-axis in a mismatch order. For example 2019/01/07, 2019/01/10, 2018/02/15, 2018/03/10, 2019/03/16 ... even though I have applied sorting to the indexes (i.e. the dates). How do I handle this issue? Thank you in advance.
I tried to sort the indexes but this did not work.
DTT_data = miniBid_data.groupby(['Mini_Bid_Date_2'])['New_Cost_Per_Load','Volume'].aggregate([np.mean])
# sort the data
DTT_data.sort_index(inplace=True, ascending=True)
fig, ax = plt.subplots()
color1 = 'tab:red'
DTT_data.plot(kind='line', figsize=(12,8), legend=False, ax=ax, logy=True, marker='*')
ax.set_title('Trends of Selected Variables')
ax.set_ylabel('Log10 of Values', color=color1)
ax.legend(loc='upper left')
ax.set_xlabel('Event Dates')
ax.tick_params(axis='y', labelcolor=color1)
#ax.legend(loc='upper left')
ax1 = ax.twinx()
color2 = 'tab:blue'
DTT_data2 = miniBid_data.groupby(['Mini_Bid_Date_2'])['Carrier_Code'].count()
DTT_data2.plot(kind='bar', figsize=(12,8), legend=False, ax=ax1, color=color2)
DTT_data2.sort_index(inplace=True, ascending=False)
ax1.set_ylabel('Log10 of Values', color=color2)
ax1.set_yscale('log')
ax1.tick_params(axis='y', labelcolor=color2)
ax1.legend(loc='upper right')
fig.autofmt_xdate()
fig.tight_layout()
plt.show()
Sample Data:
a) DTT_data =
Mini_Bid_Date_2 New_Cost_Per_Load Volume
01/07/2019 1604.3570393487105 1.6431478968792401
02/25/2018 1816.1534797297306 2.831081081081081
10/22/2018 1865.5403827160494 2.074074074074074
10/29/2018 1945.3011032028478 1.9023576512455516
01/08/2019 1947.7562972972971 1.162162162162162
02/11/2019 2062.7133737931017 2.3424827586206916
11/05/2018 2095.531836956521 1.7753623188405796
12/08/2018 2155.48935907859 1.437825203252031
02/04/2019 2169.209245791246 2.2669696969696966
02/04/2018 2189.3693333333335 5.0
01/14/2019 2313.3854211711728 1.1587162162162181
01/20/2019 2380.9063928571427 1.0
01/21/2019 2631.0407864661634 1.3657894736842129
12/03/2018 2684.0808513089005 4.402827225130894
02/25/2019 2844.047048492792 1.89397116644823
11/12/2018 3011.510282722513 2.147905759162304
10/08/2018 3042.3035776536312 1.8130726256983247
11/19/2018 3063.736631460676 1.7407865168539327
02/18/2019 3148.531689480355 6.798162230671736
10/01/2018 3248.0486851851842 2.1951388888888905
01/19/2019 3291.1334154589376 1.4626086956521749
10/15/2018 11881.90527833753 1.779911838790932
01/28/2019 13786.149445804196 1.6329195804195813
03/04/2019 14313.741501103752 1.5459455481972018
12/10/2018 100686.89588865546 3.051260504201676
b) DTT_data =
Mini_Bid_Date_2 Carrier_Code
12/08/2018 1476
03/04/2019 1359
02/04/2019 1188
10/29/2018 1124
12/03/2018 955
10/08/2018 895
11/19/2018 890
10/15/2018 794
02/18/2019 789
02/25/2019 763
01/07/2019 737
02/11/2019 725
01/21/2019 665
10/01/2018 648
02/25/2018 592
01/28/2019 572
12/10/2018 476
01/14/2019 444
11/12/2018 382
10/22/2018 324
11/05/2018 276
01/19/2019 207
01/20/2019 56
01/08/2019 37
02/04/2018 30
My expectation is to have dates (indexes) in this case show up in sequential order, for example, 2019/01/07, 2019/01/10, 2018/02/15, 2018/03/10, 2019/03/16 ... on as labels on the X-axis.
pandas
add a comment |
I have a pandas dataframe with dates as the indexes (indices). When I plot the values, the indexes(dates, i.e. the X-axis labels) do not show up in a proper sequence on the X-axis of the plotted graph. For example, instead of all the 2018 dates (e.g. 2018/02/15, 2018/03/10, 2018/10/12 ... 2019/01/07, 2019/01/10, 2019/03/16 ...), I would have these dates showing up on the X-axis in a mismatch order. For example 2019/01/07, 2019/01/10, 2018/02/15, 2018/03/10, 2019/03/16 ... even though I have applied sorting to the indexes (i.e. the dates). How do I handle this issue? Thank you in advance.
I tried to sort the indexes but this did not work.
DTT_data = miniBid_data.groupby(['Mini_Bid_Date_2'])['New_Cost_Per_Load','Volume'].aggregate([np.mean])
# sort the data
DTT_data.sort_index(inplace=True, ascending=True)
fig, ax = plt.subplots()
color1 = 'tab:red'
DTT_data.plot(kind='line', figsize=(12,8), legend=False, ax=ax, logy=True, marker='*')
ax.set_title('Trends of Selected Variables')
ax.set_ylabel('Log10 of Values', color=color1)
ax.legend(loc='upper left')
ax.set_xlabel('Event Dates')
ax.tick_params(axis='y', labelcolor=color1)
#ax.legend(loc='upper left')
ax1 = ax.twinx()
color2 = 'tab:blue'
DTT_data2 = miniBid_data.groupby(['Mini_Bid_Date_2'])['Carrier_Code'].count()
DTT_data2.plot(kind='bar', figsize=(12,8), legend=False, ax=ax1, color=color2)
DTT_data2.sort_index(inplace=True, ascending=False)
ax1.set_ylabel('Log10 of Values', color=color2)
ax1.set_yscale('log')
ax1.tick_params(axis='y', labelcolor=color2)
ax1.legend(loc='upper right')
fig.autofmt_xdate()
fig.tight_layout()
plt.show()
Sample Data:
a) DTT_data =
Mini_Bid_Date_2 New_Cost_Per_Load Volume
01/07/2019 1604.3570393487105 1.6431478968792401
02/25/2018 1816.1534797297306 2.831081081081081
10/22/2018 1865.5403827160494 2.074074074074074
10/29/2018 1945.3011032028478 1.9023576512455516
01/08/2019 1947.7562972972971 1.162162162162162
02/11/2019 2062.7133737931017 2.3424827586206916
11/05/2018 2095.531836956521 1.7753623188405796
12/08/2018 2155.48935907859 1.437825203252031
02/04/2019 2169.209245791246 2.2669696969696966
02/04/2018 2189.3693333333335 5.0
01/14/2019 2313.3854211711728 1.1587162162162181
01/20/2019 2380.9063928571427 1.0
01/21/2019 2631.0407864661634 1.3657894736842129
12/03/2018 2684.0808513089005 4.402827225130894
02/25/2019 2844.047048492792 1.89397116644823
11/12/2018 3011.510282722513 2.147905759162304
10/08/2018 3042.3035776536312 1.8130726256983247
11/19/2018 3063.736631460676 1.7407865168539327
02/18/2019 3148.531689480355 6.798162230671736
10/01/2018 3248.0486851851842 2.1951388888888905
01/19/2019 3291.1334154589376 1.4626086956521749
10/15/2018 11881.90527833753 1.779911838790932
01/28/2019 13786.149445804196 1.6329195804195813
03/04/2019 14313.741501103752 1.5459455481972018
12/10/2018 100686.89588865546 3.051260504201676
b) DTT_data =
Mini_Bid_Date_2 Carrier_Code
12/08/2018 1476
03/04/2019 1359
02/04/2019 1188
10/29/2018 1124
12/03/2018 955
10/08/2018 895
11/19/2018 890
10/15/2018 794
02/18/2019 789
02/25/2019 763
01/07/2019 737
02/11/2019 725
01/21/2019 665
10/01/2018 648
02/25/2018 592
01/28/2019 572
12/10/2018 476
01/14/2019 444
11/12/2018 382
10/22/2018 324
11/05/2018 276
01/19/2019 207
01/20/2019 56
01/08/2019 37
02/04/2018 30
My expectation is to have dates (indexes) in this case show up in sequential order, for example, 2019/01/07, 2019/01/10, 2018/02/15, 2018/03/10, 2019/03/16 ... on as labels on the X-axis.
pandas
Did you convert to date column to datetime format and then sorted it? or if the column is in str then it sorts only lexicographically
– Justice_Lords
Mar 25 at 6:39
Yes, I did. This is how I did it - data['Mini_Bid_Date_2'] = pd.to_datetime(data['Mini_Bid_Date_2'], format='%m/%d/%Y')
– Vondoe79
Mar 25 at 13:54
add a comment |
I have a pandas dataframe with dates as the indexes (indices). When I plot the values, the indexes(dates, i.e. the X-axis labels) do not show up in a proper sequence on the X-axis of the plotted graph. For example, instead of all the 2018 dates (e.g. 2018/02/15, 2018/03/10, 2018/10/12 ... 2019/01/07, 2019/01/10, 2019/03/16 ...), I would have these dates showing up on the X-axis in a mismatch order. For example 2019/01/07, 2019/01/10, 2018/02/15, 2018/03/10, 2019/03/16 ... even though I have applied sorting to the indexes (i.e. the dates). How do I handle this issue? Thank you in advance.
I tried to sort the indexes but this did not work.
DTT_data = miniBid_data.groupby(['Mini_Bid_Date_2'])['New_Cost_Per_Load','Volume'].aggregate([np.mean])
# sort the data
DTT_data.sort_index(inplace=True, ascending=True)
fig, ax = plt.subplots()
color1 = 'tab:red'
DTT_data.plot(kind='line', figsize=(12,8), legend=False, ax=ax, logy=True, marker='*')
ax.set_title('Trends of Selected Variables')
ax.set_ylabel('Log10 of Values', color=color1)
ax.legend(loc='upper left')
ax.set_xlabel('Event Dates')
ax.tick_params(axis='y', labelcolor=color1)
#ax.legend(loc='upper left')
ax1 = ax.twinx()
color2 = 'tab:blue'
DTT_data2 = miniBid_data.groupby(['Mini_Bid_Date_2'])['Carrier_Code'].count()
DTT_data2.plot(kind='bar', figsize=(12,8), legend=False, ax=ax1, color=color2)
DTT_data2.sort_index(inplace=True, ascending=False)
ax1.set_ylabel('Log10 of Values', color=color2)
ax1.set_yscale('log')
ax1.tick_params(axis='y', labelcolor=color2)
ax1.legend(loc='upper right')
fig.autofmt_xdate()
fig.tight_layout()
plt.show()
Sample Data:
a) DTT_data =
Mini_Bid_Date_2 New_Cost_Per_Load Volume
01/07/2019 1604.3570393487105 1.6431478968792401
02/25/2018 1816.1534797297306 2.831081081081081
10/22/2018 1865.5403827160494 2.074074074074074
10/29/2018 1945.3011032028478 1.9023576512455516
01/08/2019 1947.7562972972971 1.162162162162162
02/11/2019 2062.7133737931017 2.3424827586206916
11/05/2018 2095.531836956521 1.7753623188405796
12/08/2018 2155.48935907859 1.437825203252031
02/04/2019 2169.209245791246 2.2669696969696966
02/04/2018 2189.3693333333335 5.0
01/14/2019 2313.3854211711728 1.1587162162162181
01/20/2019 2380.9063928571427 1.0
01/21/2019 2631.0407864661634 1.3657894736842129
12/03/2018 2684.0808513089005 4.402827225130894
02/25/2019 2844.047048492792 1.89397116644823
11/12/2018 3011.510282722513 2.147905759162304
10/08/2018 3042.3035776536312 1.8130726256983247
11/19/2018 3063.736631460676 1.7407865168539327
02/18/2019 3148.531689480355 6.798162230671736
10/01/2018 3248.0486851851842 2.1951388888888905
01/19/2019 3291.1334154589376 1.4626086956521749
10/15/2018 11881.90527833753 1.779911838790932
01/28/2019 13786.149445804196 1.6329195804195813
03/04/2019 14313.741501103752 1.5459455481972018
12/10/2018 100686.89588865546 3.051260504201676
b) DTT_data =
Mini_Bid_Date_2 Carrier_Code
12/08/2018 1476
03/04/2019 1359
02/04/2019 1188
10/29/2018 1124
12/03/2018 955
10/08/2018 895
11/19/2018 890
10/15/2018 794
02/18/2019 789
02/25/2019 763
01/07/2019 737
02/11/2019 725
01/21/2019 665
10/01/2018 648
02/25/2018 592
01/28/2019 572
12/10/2018 476
01/14/2019 444
11/12/2018 382
10/22/2018 324
11/05/2018 276
01/19/2019 207
01/20/2019 56
01/08/2019 37
02/04/2018 30
My expectation is to have dates (indexes) in this case show up in sequential order, for example, 2019/01/07, 2019/01/10, 2018/02/15, 2018/03/10, 2019/03/16 ... on as labels on the X-axis.
pandas
I have a pandas dataframe with dates as the indexes (indices). When I plot the values, the indexes(dates, i.e. the X-axis labels) do not show up in a proper sequence on the X-axis of the plotted graph. For example, instead of all the 2018 dates (e.g. 2018/02/15, 2018/03/10, 2018/10/12 ... 2019/01/07, 2019/01/10, 2019/03/16 ...), I would have these dates showing up on the X-axis in a mismatch order. For example 2019/01/07, 2019/01/10, 2018/02/15, 2018/03/10, 2019/03/16 ... even though I have applied sorting to the indexes (i.e. the dates). How do I handle this issue? Thank you in advance.
I tried to sort the indexes but this did not work.
DTT_data = miniBid_data.groupby(['Mini_Bid_Date_2'])['New_Cost_Per_Load','Volume'].aggregate([np.mean])
# sort the data
DTT_data.sort_index(inplace=True, ascending=True)
fig, ax = plt.subplots()
color1 = 'tab:red'
DTT_data.plot(kind='line', figsize=(12,8), legend=False, ax=ax, logy=True, marker='*')
ax.set_title('Trends of Selected Variables')
ax.set_ylabel('Log10 of Values', color=color1)
ax.legend(loc='upper left')
ax.set_xlabel('Event Dates')
ax.tick_params(axis='y', labelcolor=color1)
#ax.legend(loc='upper left')
ax1 = ax.twinx()
color2 = 'tab:blue'
DTT_data2 = miniBid_data.groupby(['Mini_Bid_Date_2'])['Carrier_Code'].count()
DTT_data2.plot(kind='bar', figsize=(12,8), legend=False, ax=ax1, color=color2)
DTT_data2.sort_index(inplace=True, ascending=False)
ax1.set_ylabel('Log10 of Values', color=color2)
ax1.set_yscale('log')
ax1.tick_params(axis='y', labelcolor=color2)
ax1.legend(loc='upper right')
fig.autofmt_xdate()
fig.tight_layout()
plt.show()
Sample Data:
a) DTT_data =
Mini_Bid_Date_2 New_Cost_Per_Load Volume
01/07/2019 1604.3570393487105 1.6431478968792401
02/25/2018 1816.1534797297306 2.831081081081081
10/22/2018 1865.5403827160494 2.074074074074074
10/29/2018 1945.3011032028478 1.9023576512455516
01/08/2019 1947.7562972972971 1.162162162162162
02/11/2019 2062.7133737931017 2.3424827586206916
11/05/2018 2095.531836956521 1.7753623188405796
12/08/2018 2155.48935907859 1.437825203252031
02/04/2019 2169.209245791246 2.2669696969696966
02/04/2018 2189.3693333333335 5.0
01/14/2019 2313.3854211711728 1.1587162162162181
01/20/2019 2380.9063928571427 1.0
01/21/2019 2631.0407864661634 1.3657894736842129
12/03/2018 2684.0808513089005 4.402827225130894
02/25/2019 2844.047048492792 1.89397116644823
11/12/2018 3011.510282722513 2.147905759162304
10/08/2018 3042.3035776536312 1.8130726256983247
11/19/2018 3063.736631460676 1.7407865168539327
02/18/2019 3148.531689480355 6.798162230671736
10/01/2018 3248.0486851851842 2.1951388888888905
01/19/2019 3291.1334154589376 1.4626086956521749
10/15/2018 11881.90527833753 1.779911838790932
01/28/2019 13786.149445804196 1.6329195804195813
03/04/2019 14313.741501103752 1.5459455481972018
12/10/2018 100686.89588865546 3.051260504201676
b) DTT_data =
Mini_Bid_Date_2 Carrier_Code
12/08/2018 1476
03/04/2019 1359
02/04/2019 1188
10/29/2018 1124
12/03/2018 955
10/08/2018 895
11/19/2018 890
10/15/2018 794
02/18/2019 789
02/25/2019 763
01/07/2019 737
02/11/2019 725
01/21/2019 665
10/01/2018 648
02/25/2018 592
01/28/2019 572
12/10/2018 476
01/14/2019 444
11/12/2018 382
10/22/2018 324
11/05/2018 276
01/19/2019 207
01/20/2019 56
01/08/2019 37
02/04/2018 30
My expectation is to have dates (indexes) in this case show up in sequential order, for example, 2019/01/07, 2019/01/10, 2018/02/15, 2018/03/10, 2019/03/16 ... on as labels on the X-axis.
pandas
pandas
asked Mar 25 at 5:59
Vondoe79Vondoe79
859
859
Did you convert to date column to datetime format and then sorted it? or if the column is in str then it sorts only lexicographically
– Justice_Lords
Mar 25 at 6:39
Yes, I did. This is how I did it - data['Mini_Bid_Date_2'] = pd.to_datetime(data['Mini_Bid_Date_2'], format='%m/%d/%Y')
– Vondoe79
Mar 25 at 13:54
add a comment |
Did you convert to date column to datetime format and then sorted it? or if the column is in str then it sorts only lexicographically
– Justice_Lords
Mar 25 at 6:39
Yes, I did. This is how I did it - data['Mini_Bid_Date_2'] = pd.to_datetime(data['Mini_Bid_Date_2'], format='%m/%d/%Y')
– Vondoe79
Mar 25 at 13:54
Did you convert to date column to datetime format and then sorted it? or if the column is in str then it sorts only lexicographically
– Justice_Lords
Mar 25 at 6:39
Did you convert to date column to datetime format and then sorted it? or if the column is in str then it sorts only lexicographically
– Justice_Lords
Mar 25 at 6:39
Yes, I did. This is how I did it - data['Mini_Bid_Date_2'] = pd.to_datetime(data['Mini_Bid_Date_2'], format='%m/%d/%Y')
– Vondoe79
Mar 25 at 13:54
Yes, I did. This is how I did it - data['Mini_Bid_Date_2'] = pd.to_datetime(data['Mini_Bid_Date_2'], format='%m/%d/%Y')
– Vondoe79
Mar 25 at 13:54
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55331992%2fhow-to-sort-date-index-of-a-pandas-dataframe-so-that-all-the-newer-year-dates-ar%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55331992%2fhow-to-sort-date-index-of-a-pandas-dataframe-so-that-all-the-newer-year-dates-ar%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did you convert to date column to datetime format and then sorted it? or if the column is in str then it sorts only lexicographically
– Justice_Lords
Mar 25 at 6:39
Yes, I did. This is how I did it - data['Mini_Bid_Date_2'] = pd.to_datetime(data['Mini_Bid_Date_2'], format='%m/%d/%Y')
– Vondoe79
Mar 25 at 13:54