Skip to content

Commit 8545489

Browse files
committed
Removed scikit-timeseries migration docs from FAQ
Issue #10281
1 parent 5bf4ff2 commit 8545489

File tree

1 file changed

+0
-143
lines changed

1 file changed

+0
-143
lines changed

doc/source/faq.rst

-143
Original file line numberDiff line numberDiff line change
@@ -81,149 +81,6 @@ representation; i.e., 1KB = 1024 bytes).
8181

8282
See also :ref:`Categorical Memory Usage <categorical.memory>`.
8383

84-
85-
.. _ref-scikits-migration:
86-
87-
Migrating from scikits.timeseries to pandas >= 0.8.0
88-
----------------------------------------------------
89-
90-
Starting with pandas 0.8.0, users of scikits.timeseries should have all of the
91-
features that they need to migrate their code to use pandas. Portions of the
92-
scikits.timeseries codebase for implementing calendar logic and timespan
93-
frequency conversions (but **not** resampling, that has all been implemented
94-
from scratch from the ground up) have been ported to the pandas codebase.
95-
96-
The scikits.timeseries notions of ``Date`` and ``DateArray`` are responsible
97-
for implementing calendar logic:
98-
99-
::
100-
101-
In [16]: dt = ts.Date('Q', '1984Q3')
102-
103-
# sic
104-
In [17]: dt
105-
Out[17]: <Q-DEC : 1984Q1>
106-
107-
In [18]: dt.asfreq('D', 'start')
108-
Out[18]: <D : 01-Jan-1984>
109-
110-
In [19]: dt.asfreq('D', 'end')
111-
Out[19]: <D : 31-Mar-1984>
112-
113-
In [20]: dt + 3
114-
Out[20]: <Q-DEC : 1984Q4>
115-
116-
``Date`` and ``DateArray`` from scikits.timeseries have been reincarnated in
117-
pandas ``Period`` and ``PeriodIndex``:
118-
119-
.. ipython:: python
120-
121-
pd.pnow('D') # scikits.timeseries.now()
122-
pd.Period(year=2007, month=3, day=15, freq='D')
123-
p = pd.Period('1984Q3')
124-
p
125-
p.asfreq('D', 'start')
126-
p.asfreq('D', 'end')
127-
(p + 3).asfreq('T') + 6 * 60 + 30
128-
rng = pd.period_range('1990', '2010', freq='A')
129-
rng
130-
rng.asfreq('B', 'end') - 3
131-
132-
.. csv-table::
133-
:header: "scikits.timeseries", "pandas", "Notes"
134-
:widths: 20, 20, 60
135-
136-
Date, Period, "A span of time, from yearly through to secondly"
137-
DateArray, PeriodIndex, "An array of timespans"
138-
convert, resample, "Frequency conversion in scikits.timeseries"
139-
convert_to_annual, pivot_annual, "currently supports up to daily frequency, see :issue:`736`"
140-
141-
142-
PeriodIndex / DateArray properties and functions
143-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
144-
145-
The scikits.timeseries ``DateArray`` had a number of information
146-
properties. Here are the pandas equivalents:
147-
148-
.. csv-table::
149-
:header: "scikits.timeseries", "pandas", "Notes"
150-
:widths: 20, 60, 20
151-
152-
get_steps, ``np.diff(idx.values)``,
153-
has_missing_dates, ``not idx.is_full``,
154-
is_full, ``idx.is_full``,
155-
is_valid, ``idx.is_monotonic and idx.is_unique``,
156-
is_chronological, ``is_monotonic``,
157-
``arr.sort_chronologically()``, ``idx.order()``,
158-
159-
Frequency conversion
160-
~~~~~~~~~~~~~~~~~~~~
161-
162-
Frequency conversion is implemented using the ``resample`` method on Series
163-
and DataFrame objects with a DatetimeIndex or PeriodIndex. ``resample`` also
164-
works on panels (3D). Here is some code that resamples daily data to montly:
165-
166-
.. ipython:: python
167-
168-
rng = pd.period_range('Jan-2000', periods=50, freq='M')
169-
data = pd.Series(np.random.randn(50), index=rng)
170-
data
171-
data.resample('A', how=np.mean)
172-
173-
Plotting
174-
~~~~~~~~
175-
176-
Much of the plotting functionality of scikits.timeseries has been ported and
177-
adopted to pandas's data structures. For example:
178-
179-
.. ipython:: python
180-
181-
rng = pd.period_range('1987Q2', periods=10, freq='Q-DEC')
182-
data = pd.Series(np.random.randn(10), index=rng)
183-
184-
@savefig skts_ts_plot.png
185-
data.plot()
186-
187-
Converting to and from period format
188-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
189-
190-
Use the ``to_timestamp`` and ``to_period`` instance methods.
191-
192-
Treatment of missing data
193-
~~~~~~~~~~~~~~~~~~~~~~~~~
194-
195-
Unlike scikits.timeseries, pandas data structures are not based on NumPy's
196-
``MaskedArray`` object. Missing data is represented as ``NaN`` in numerical
197-
arrays and either as ``None`` or ``NaN`` in non-numerical arrays. Implementing
198-
a version of pandas's data structures that use MaskedArray is possible but
199-
would require the involvement of a dedicated maintainer. Active pandas
200-
developers are not interested in this.
201-
202-
Resampling with timestamps and periods
203-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
204-
205-
``resample`` has a ``kind`` argument which allows you to resample time series
206-
with a DatetimeIndex to PeriodIndex:
207-
208-
.. ipython:: python
209-
210-
rng = pd.date_range('1/1/2000', periods=200, freq='D')
211-
data = pd.Series(np.random.randn(200), index=rng)
212-
data[:10]
213-
data.index
214-
data.resample('M', kind='period')
215-
216-
Similarly, resampling from periods to timestamps is possible with an optional
217-
interval (``'start'`` or ``'end'``) convention:
218-
219-
.. ipython:: python
220-
221-
rng = pd.period_range('Jan-2000', periods=50, freq='M')
222-
data = pd.Series(np.random.randn(50), index=rng)
223-
resampled = data.resample('A', kind='timestamp', convention='end')
224-
resampled.index
225-
226-
22784
Byte-Ordering Issues
22885
--------------------
22986
Occasionally you may have to deal with data that were created on a machine with

0 commit comments

Comments
 (0)