forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperiod.py
33 lines (21 loc) · 917 Bytes
/
period.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from pandas import Series, Period, PeriodIndex, date_range
class create_period_index_from_date_range(object):
goal_time = 0.2
def time_period_index(self):
# Simulate irregular PeriodIndex
PeriodIndex(date_range('1985', periods=1000).to_pydatetime(), freq='D')
class period_algorithm(object):
goal_time = 0.2
def setup(self):
data = [Period('2011-01', freq='M'), Period('2011-02', freq='M'),
Period('2011-03', freq='M'), Period('2011-04', freq='M')]
self.s = Series(data * 1000)
self.i = PeriodIndex(data, freq='M')
def time_period_series_drop_duplicates(self):
self.s.drop_duplicates()
def time_period_index_drop_duplicates(self):
self.i.drop_duplicates()
def time_period_series_value_counts(self):
self.s.value_counts()
def time_period_index_value_counts(self):
self.i.value_counts()