|
| 1 | +# The StringAccessor class defined below is an adaptation of the |
| 2 | +# pandas string methods source code (see pd.core.strings) |
| 3 | + |
| 4 | +# For reference, here is a copy of the pandas copyright notice: |
| 5 | + |
| 6 | +# (c) 2011-2012, Lambda Foundry, Inc. and PyData Development Team |
| 7 | +# All rights reserved. |
| 8 | + |
| 9 | +# Copyright (c) 2008-2011 AQR Capital Management, LLC |
| 10 | +# All rights reserved. |
| 11 | + |
| 12 | +# Redistribution and use in source and binary forms, with or without |
| 13 | +# modification, are permitted provided that the following conditions are |
| 14 | +# met: |
| 15 | + |
| 16 | +# * Redistributions of source code must retain the above copyright |
| 17 | +# notice, this list of conditions and the following disclaimer. |
| 18 | + |
| 19 | +# * Redistributions in binary form must reproduce the above |
| 20 | +# copyright notice, this list of conditions and the following |
| 21 | +# disclaimer in the documentation and/or other materials provided |
| 22 | +# with the distribution. |
| 23 | + |
| 24 | +# * Neither the name of the copyright holder nor the names of any |
| 25 | +# contributors may be used to endorse or promote products derived |
| 26 | +# from this software without specific prior written permission. |
| 27 | + |
| 28 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS |
| 29 | +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 30 | +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 31 | +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 32 | +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 33 | +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 34 | +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 35 | +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 36 | +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 37 | +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 38 | +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 39 | + |
1 | 40 | import codecs
|
2 | 41 | import re
|
3 | 42 | import textwrap
|
@@ -33,8 +72,8 @@ class StringAccessor:
|
33 | 72 |
|
34 | 73 | """
|
35 | 74 |
|
36 |
| - def __init__(self, xarray_obj): |
37 |
| - self._obj = xarray_obj |
| 75 | + def __init__(self, obj): |
| 76 | + self._obj = obj |
38 | 77 |
|
39 | 78 | def _apply(self, f, dtype=None):
|
40 | 79 | # TODO handling of na values ?
|
|
0 commit comments