dashawn
dashawn

Reputation: 63

Get outliers in a DataFrame with date

I am new to pandas. I have a DataFrame from a list of datetime objects. I'm looking to get the outlier dates in the set. I tried using the std() functions and google with no luck. :( Any help please?

date_list = []
for event in get_events():
    date_list.append(event["date"])

event_series = pandas.DataFrame(date_list)
# get outlier set here.

I'm looking for a dataset like

[ 1/1/2000,
1/2/2000,
1/3/2000,
1/4/2000,
1/1/2005 ]

to return 1/1/2005 as an outlier.

Upvotes: 3

Views: 2089

Answers (1)

Rainy
Rainy

Reputation: 1106

Where df is your dataframe:

print(df[ np.abs(df.Data - df.Data.mean()) > 1.5*df.Data.std() ])

Upvotes: 3

Related Questions