Search code examples
pythonpandasdatetimegroup-bydata-manipulation

How to get the min date if when a string showed?


Hello Stackoverflow Community, I am having trouble finding out how to get the min date if when a a string showed up. For example I know how to get min date by doing df['date'].min() but I have a column named system which has the names of all of the systems. I am trying to see when was the most earliest system and this was my code. df.groupby('date')['system'].min() but it did not work could someone please help me?

Here is my code that i tried but I got an error df.groupby('date')['system'].min()


Solution

  • Yeah without a dataframe example, it's hard to answer and understand your question correctly! But I believe the solution is:

    df.groupby('system')['date'].min()