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


Python pandas.__version__方法代码示例

本文整理汇总了Python中pandas.__version__方法的典型用法代码示例。如果您正苦于以下问题:Python pandas.__version__方法的具体用法?Python pandas.__version__怎么用?Python pandas.__version__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pandas的用法示例。


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

示例1: write_legacy_pickles

# 需要导入模块: import pandas [as 别名]
# 或者: from pandas import __version__ [as 别名]
def write_legacy_pickles(output_dir):

    # make sure we are < 0.13 compat (in py3)
    try:
        from pandas.compat import zip, cPickle as pickle  # noqa
    except ImportError:
        import pickle

    version = pandas.__version__

    print("This script generates a storage file for the current arch, system, "
          "and python version")
    print("  pandas version: {0}".format(version))
    print("  output dir    : {0}".format(output_dir))
    print("  storage format: pickle")

    pth = '{0}.pickle'.format(platform_name())

    fh = open(os.path.join(output_dir, pth), 'wb')
    pickle.dump(create_pickle_data(), fh, pickle.HIGHEST_PROTOCOL)
    fh.close()

    print("created pickle file: %s" % pth) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:25,代码来源:generate_legacy_storage_files.py

示例2: write_legacy_pickles

# 需要导入模块: import pandas [as 别名]
# 或者: from pandas import __version__ [as 别名]
def write_legacy_pickles(output_dir):

    # make sure we are < 0.13 compat (in py3)
    try:
        from pandas.compat import zip, cPickle as pickle  # noqa
    except:
        import pickle

    version = pandas.__version__

    print("This script generates a storage file for the current arch, system, "
          "and python version")
    print("  pandas version: {0}".format(version))
    print("  output dir    : {0}".format(output_dir))
    print("  storage format: pickle")

    pth = '{0}.pickle'.format(platform_name())

    fh = open(os.path.join(output_dir, pth), 'wb')
    pickle.dump(create_pickle_data(), fh, pickle.HIGHEST_PROTOCOL)
    fh.close()

    print("created pickle file: %s" % pth) 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:25,代码来源:generate_legacy_storage_files.py

示例3: test_open_args

# 需要导入模块: import pandas [as 别名]
# 或者: from pandas import __version__ [as 别名]
def test_open_args(self):

        with ensure_clean_path(self.path) as path:

            df = tm.makeDataFrame()

            # create an in memory store
            store = HDFStore(path,mode='a',driver='H5FD_CORE',driver_core_backing_store=0)
            store['df'] = df
            store.append('df2',df)

            tm.assert_frame_equal(store['df'],df)
            tm.assert_frame_equal(store['df2'],df)

            store.close()

            # only supported on pytable >= 3.0.0
            if LooseVersion(tables.__version__) >= '3.0.0':

                # the file should not have actually been written
                self.assert_(os.path.exists(path) is False) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:23,代码来源:test_pytables.py

示例4: test_encoding

# 需要导入模块: import pandas [as 别名]
# 或者: from pandas import __version__ [as 别名]
def test_encoding(self):

        if LooseVersion(tables.__version__) < '3.0.0':
            raise nose.SkipTest('tables version does not support proper encoding')
        if sys.byteorder != 'little':
            raise nose.SkipTest('system byteorder is not little')

        with ensure_clean_store(self.path) as store:
            df = DataFrame(dict(A='foo',B='bar'),index=range(5))
            df.loc[2,'A'] = np.nan
            df.loc[3,'B'] = np.nan
            _maybe_remove(store, 'df')
            store.append('df', df, encoding='ascii')
            tm.assert_frame_equal(store['df'], df)

            expected = df.reindex(columns=['A'])
            result = store.select('df',Term('columns=A',encoding='ascii'))
            tm.assert_frame_equal(result,expected) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:20,代码来源:test_pytables.py

示例5: test_legacy_table_write

# 需要导入模块: import pandas [as 别名]
# 或者: from pandas import __version__ [as 别名]
def test_legacy_table_write(self):
        raise nose.SkipTest("skipping for now")

        store = HDFStore(tm.get_data_path('legacy_hdf/legacy_table_%s.h5' % pandas.__version__), 'a')

        df = tm.makeDataFrame()
        wp = tm.makePanel()

        index = MultiIndex(levels=[['foo', 'bar', 'baz', 'qux'],
                                   ['one', 'two', 'three']],
                           labels=[[0, 0, 0, 1, 1, 2, 2, 3, 3, 3],
                                   [0, 1, 2, 0, 1, 1, 2, 0, 1, 2]],
                           names=['foo', 'bar'])
        df = DataFrame(np.random.randn(10, 3), index=index,
                       columns=['A', 'B', 'C'])
        store.append('mi', df)

        df = DataFrame(dict(A = 'foo', B = 'bar'),index=lrange(10))
        store.append('df', df, data_columns = ['B'], min_itemsize={'A' : 200 })
        store.append('wp', wp)

        store.close() 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:24,代码来源:test_pytables.py

示例6: require_minimum_pandas_version

# 需要导入模块: import pandas [as 别名]
# 或者: from pandas import __version__ [as 别名]
def require_minimum_pandas_version():
    """ Raise ImportError if minimum version of Pandas is not installed
    """
    # TODO(HyukjinKwon): Relocate and deduplicate the version specification.
    minimum_pandas_version = "0.19.2"

    from distutils.version import LooseVersion
    try:
        import pandas
        have_pandas = True
    except ImportError:
        have_pandas = False
    if not have_pandas:
        raise ImportError("Pandas >= %s must be installed; however, "
                          "it was not found." % minimum_pandas_version)
    if LooseVersion(pandas.__version__) < LooseVersion(minimum_pandas_version):
        raise ImportError("Pandas >= %s must be installed; however, "
                          "your version was %s." % (minimum_pandas_version, pandas.__version__)) 
开发者ID:runawayhorse001,项目名称:LearningApacheSpark,代码行数:20,代码来源:utils.py

示例7: require_minimum_pyarrow_version

# 需要导入模块: import pandas [as 别名]
# 或者: from pandas import __version__ [as 别名]
def require_minimum_pyarrow_version():
    """ Raise ImportError if minimum version of pyarrow is not installed
    """
    # TODO(HyukjinKwon): Relocate and deduplicate the version specification.
    minimum_pyarrow_version = "0.8.0"

    from distutils.version import LooseVersion
    try:
        import pyarrow
        have_arrow = True
    except ImportError:
        have_arrow = False
    if not have_arrow:
        raise ImportError("PyArrow >= %s must be installed; however, "
                          "it was not found." % minimum_pyarrow_version)
    if LooseVersion(pyarrow.__version__) < LooseVersion(minimum_pyarrow_version):
        raise ImportError("PyArrow >= %s must be installed; however, "
                          "your version was %s." % (minimum_pyarrow_version, pyarrow.__version__)) 
开发者ID:runawayhorse001,项目名称:LearningApacheSpark,代码行数:20,代码来源:utils.py

示例8: _symmetric_difference

# 需要导入模块: import pandas [as 别名]
# 或者: from pandas import __version__ [as 别名]
def _symmetric_difference(idxs):
    """ Returns the chained symmetrical difference of the indexes given.

    Parameters
    ----------
    idxs : list
        List of pandas.Index objects.

    Returns
    -------
    idx : pandas.Index
        The result of the chained symmetrical difference of the indexes
        given.
    """
    idx = idxs[0]
    for idx_part in idxs[1:]:
        if pd.__version__ == '0.19.2':
            idx = idx.symmetric_difference(idx_part)
        else:
            idx = idx.sym_diff(idx_part)
    return idx 
开发者ID:Quantipy,项目名称:quantipy,代码行数:23,代码来源:logic.py

示例9: _make_bqstorage_client

# 需要导入模块: import pandas [as 别名]
# 或者: from pandas import __version__ [as 别名]
def _make_bqstorage_client(use_bqstorage_api, credentials):
    if not use_bqstorage_api:
        return None

    if bigquery_storage_v1beta1 is None:
        raise ImportError(
            "Install the google-cloud-bigquery-storage and fastavro/pyarrow "
            "packages to use the BigQuery Storage API."
        )

    import google.api_core.gapic_v1.client_info
    import pandas

    client_info = google.api_core.gapic_v1.client_info.ClientInfo(
        user_agent="pandas-{}".format(pandas.__version__)
    )
    return bigquery_storage_v1beta1.BigQueryStorageClient(
        credentials=credentials, client_info=client_info
    ) 
开发者ID:pydata,项目名称:pandas-gbq,代码行数:21,代码来源:gbq.py

示例10: test_rfloordiv

# 需要导入模块: import pandas [as 别名]
# 或者: from pandas import __version__ [as 别名]
def test_rfloordiv(self):
        pdf = pd.DataFrame(
            {"angles": [0, 3, 4], "degrees": [360, 180, 360]},
            index=["circle", "triangle", "rectangle"],
            columns=["angles", "degrees"],
        )
        kdf = ks.from_pandas(pdf)

        if LooseVersion(pd.__version__) < LooseVersion("1.0.0") and LooseVersion(
            pd.__version__
        ) >= LooseVersion("0.24.0"):
            expected_result = pd.DataFrame(
                {"angles": [np.inf, 3.0, 2.0], "degrees": [0.0, 0.0, 0.0]},
                index=["circle", "triangle", "rectangle"],
                columns=["angles", "degrees"],
            )
        else:
            expected_result = pdf.rfloordiv(10)

        self.assert_eq(kdf.rfloordiv(10), expected_result) 
开发者ID:databricks,项目名称:koalas,代码行数:22,代码来源:test_dataframe.py

示例11: test_get_dummies_dtype

# 需要导入模块: import pandas [as 别名]
# 或者: from pandas import __version__ [as 别名]
def test_get_dummies_dtype(self):
        pdf = pd.DataFrame(
            {
                # "A": pd.Categorical(['a', 'b', 'a'], categories=['a', 'b', 'c']),
                "A": ["a", "b", "a"],
                "B": [0, 0, 1],
            }
        )
        kdf = ks.from_pandas(pdf)

        if LooseVersion("0.23.0") <= LooseVersion(pd.__version__):
            exp = pd.get_dummies(pdf, dtype="float64")
        else:
            exp = pd.get_dummies(pdf)
            exp = exp.astype({"A_a": "float64", "A_b": "float64"})
        res = ks.get_dummies(kdf, dtype="float64")
        self.assert_eq(res, exp, almost=True) 
开发者ID:databricks,项目名称:koalas,代码行数:19,代码来源:test_reshape.py

示例12: test_repeat

# 需要导入模块: import pandas [as 别名]
# 或者: from pandas import __version__ [as 别名]
def test_repeat(self):
        pser = pd.Series(["a", "b", "c"], name="0", index=np.random.rand(3))
        kser = ks.from_pandas(pser)

        self.assert_eq(kser.repeat(3).sort_index(), pser.repeat(3).sort_index())
        self.assert_eq(kser.repeat(0).sort_index(), pser.repeat(0).sort_index())

        self.assertRaises(ValueError, lambda: kser.repeat(-1))
        self.assertRaises(ValueError, lambda: kser.repeat("abc"))

        pdf = pd.DataFrame({"a": ["a", "b", "c"], "rep": [10, 20, 30]}, index=np.random.rand(3))
        kdf = ks.from_pandas(pdf)

        if LooseVersion(pyspark.__version__) < LooseVersion("2.4"):
            self.assertRaises(ValueError, lambda: kdf.a.repeat(kdf.rep))
        else:
            self.assert_eq(kdf.a.repeat(kdf.rep).sort_index(), pdf.a.repeat(pdf.rep).sort_index()) 
开发者ID:databricks,项目名称:koalas,代码行数:19,代码来源:test_series.py

示例13: platform_name

# 需要导入模块: import pandas [as 别名]
# 或者: from pandas import __version__ [as 别名]
def platform_name():
    return '_'.join([str(pandas.__version__), str(pl.machine()),
                     str(pl.system().lower()), str(pl.python_version())]) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:5,代码来源:generate_legacy_storage_files.py

示例14: write_legacy_msgpack

# 需要导入模块: import pandas [as 别名]
# 或者: from pandas import __version__ [as 别名]
def write_legacy_msgpack(output_dir, compress):

    version = pandas.__version__

    print("This script generates a storage file for the current arch, "
          "system, and python version")
    print("  pandas version: {0}".format(version))
    print("  output dir    : {0}".format(output_dir))
    print("  storage format: msgpack")
    pth = '{0}.msgpack'.format(platform_name())
    to_msgpack(os.path.join(output_dir, pth), create_msgpack_data(),
               compress=compress)

    print("created msgpack file: %s" % pth) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:16,代码来源:generate_legacy_storage_files.py

示例15: test_dc_import

# 需要导入模块: import pandas [as 别名]
# 或者: from pandas import __version__ [as 别名]
def test_dc_import(self):
    import deepchem
    print(deepchem.__version__) 
开发者ID:deepchem,项目名称:deepchem,代码行数:5,代码来源:run_test.py


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