當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。