当前位置: 首页>>代码示例>>Python>>正文


Python data._is_structured_ndarray函数代码示例

本文整理汇总了Python中statsmodels.tools.data._is_structured_ndarray函数的典型用法代码示例。如果您正苦于以下问题:Python _is_structured_ndarray函数的具体用法?Python _is_structured_ndarray怎么用?Python _is_structured_ndarray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_is_structured_ndarray函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, fname, data, convert_dates=None, encoding="latin-1",
                 byteorder=None):

        self._convert_dates = convert_dates
        # attach nobs, nvars, data, varlist, typlist
        if data_util._is_using_pandas(data, None):
            self._prepare_pandas(data)

        elif data_util._is_array_like(data, None):
            data = np.asarray(data)
            if data_util._is_structured_ndarray(data):
                self._prepare_structured_array(data)
            else:
                if convert_dates is not None:
                    raise ValueError("Not able to convert dates in a plain"
                                     " ndarray.")
                self._prepare_ndarray(data)

        else: # pragma : no cover
            raise ValueError("Type %s for data not understood" % type(data))


        if byteorder is None:
            byteorder = sys.byteorder
        self._byteorder = _set_endianness(byteorder)
        self._encoding = encoding
        self._file = _open_file_binary_write(fname, encoding)
开发者ID:SuperXrooT,项目名称:statsmodels,代码行数:27,代码来源:foreign.py

示例2: __init__

    def __init__(self, fname, data, convert_dates=None, encoding="latin-1",
                 byteorder=None):
        warnings.warn(
            "StataWriter is deprecated as of 0.10.0 and will be removed in a "
            "future version.  Use pandas.DataFrame.to_stata or "
            "pandas.io.stata.StatWriter instead.",
            FutureWarning)

        self._convert_dates = convert_dates
        # attach nobs, nvars, data, varlist, typlist
        if data_util._is_using_pandas(data, None):
            self._prepare_pandas(data)

        elif data_util._is_array_like(data, None):
            data = np.asarray(data)
            if data_util._is_structured_ndarray(data):
                self._prepare_structured_array(data)
            else:
                if convert_dates is not None:
                    raise ValueError("Not able to convert dates in a plain"
                                     " ndarray.")
                self._prepare_ndarray(data)

        else: # pragma : no cover
            raise ValueError("Type %s for data not understood" % type(data))


        if byteorder is None:
            byteorder = sys.byteorder
        self._byteorder = _set_endianness(byteorder)
        self._encoding = encoding
        self._file = get_file_obj(fname, 'wb', encoding)
开发者ID:bashtage,项目名称:statsmodels,代码行数:32,代码来源:foreign.py

示例3: _get_yarr

    def _get_yarr(self, endog):
        if data_util._is_structured_ndarray(endog):
            endog = data_util.struct_to_ndarray(endog)
        endog = np.asarray(endog)
        if len(endog) == 1:  # never squeeze to a scalar
            if endog.ndim == 1:
                return endog
            elif endog.ndim > 1:
                return np.asarray([endog.squeeze()])

        return endog.squeeze()
开发者ID:Bhushan1002,项目名称:statsmodels,代码行数:11,代码来源:data.py

示例4: _get_xarr

 def _get_xarr(self, exog):
     if data_util._is_structured_ndarray(exog):
         exog = data_util.struct_to_ndarray(exog)
     return np.asarray(exog)
开发者ID:EdTenerife,项目名称:statsmodels,代码行数:4,代码来源:data.py

示例5: _get_yarr

 def _get_yarr(self, endog):
     if data_util._is_structured_ndarray(endog):
         endog = data_util.struct_to_ndarray(endog)
     return np.asarray(endog).squeeze()
开发者ID:EdTenerife,项目名称:statsmodels,代码行数:4,代码来源:data.py


注:本文中的statsmodels.tools.data._is_structured_ndarray函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。