14
14
15
15
16
16
BIGQUERY_INSTALLED_VERSION = None
17
+ PANDAS_HAS_DEPRECATED_VERBOSITY = False
17
18
18
19
19
20
def _check_google_client_version ():
20
- global BIGQUERY_INSTALLED_VERSION
21
+ global BIGQUERY_INSTALLED_VERSION , PANDAS_HAS_VERBOSITY_DEFAULT
21
22
22
23
try :
23
24
import pkg_resources
@@ -36,6 +37,14 @@ def _check_google_client_version():
36
37
'current version {1}' .format (
37
38
bigquery_minimum_version , BIGQUERY_INSTALLED_VERSION ))
38
39
40
+ # Add check for Pandas version before showing deprecation warning.
41
+ # https://github.com/pydata/pandas-gbq/issues/157
42
+ pandas_installed_version = pkg_resources .get_distribution (
43
+ 'pandas' ).parsed_version
44
+ pandas_version_wo_verbosity = pkg_resources .parse_version ('0.23.0' )
45
+ PANDAS_HAS_DEPRECATED_VERBOSITY = (
46
+ pandas_installed_version > pandas_version_wo_verbosity )
47
+
39
48
40
49
def _test_google_api_imports ():
41
50
@@ -791,14 +800,15 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None,
791
800
DataFrame representing results of query
792
801
793
802
"""
794
- if verbose is not None :
803
+
804
+ _test_google_api_imports ()
805
+
806
+ if verbose is not None and PANDAS_HAS_DEPRECATED_VERBOSITY :
795
807
warnings .warn (
796
808
"verbose is deprecated and will be removed in "
797
809
"a future version. Set logging level in order to vary "
798
810
"verbosity" , FutureWarning , stacklevel = 1 )
799
811
800
- _test_google_api_imports ()
801
-
802
812
if not project_id :
803
813
raise TypeError ("Missing required parameter: project_id" )
804
814
@@ -920,7 +930,7 @@ def to_gbq(dataframe, destination_table, project_id, chunksize=None,
920
930
921
931
_test_google_api_imports ()
922
932
923
- if verbose is not None :
933
+ if verbose is not None and PANDAS_HAS_DEPRECATED_VERBOSITY :
924
934
warnings .warn (
925
935
"verbose is deprecated and will be removed in "
926
936
"a future version. Set logging level in order to vary "
0 commit comments