@@ -771,7 +771,7 @@ def _map_series_op(self, op, other):
771771 if not isinstance (other , DataFrame ) and (
772772 isinstance (other , IndexOpsMixin ) or is_sequence (other )
773773 ):
774- raise ValueError (
774+ raise TypeError (
775775 "%s with a sequence is currently not supported; "
776776 "however, got %s." % (op , type (other ).__name__ )
777777 )
@@ -2936,7 +2936,7 @@ class locomotion
29362936 from pyspark .pandas .series import first_series
29372937
29382938 if not is_name_like_value (key ):
2939- raise ValueError ("'key' should be a scalar value or tuple that contains scalar values" )
2939+ raise TypeError ("'key' should be a scalar value or tuple that contains scalar values" )
29402940
29412941 if level is not None and is_name_like_tuple (key ):
29422942 raise KeyError (key )
@@ -3301,7 +3301,7 @@ def where(self, cond, other=np.nan) -> "DataFrame":
33013301 ]
33023302 kdf [tmp_cond_col_names ] = cond
33033303 else :
3304- raise ValueError ("type of cond must be a DataFrame or Series" )
3304+ raise TypeError ("type of cond must be a DataFrame or Series" )
33053305
33063306 tmp_other_col_names = [
33073307 tmp_other_col_name (name_like_string (label )) for label in self ._internal .column_labels
@@ -3431,7 +3431,7 @@ def mask(self, cond, other=np.nan) -> "DataFrame":
34313431 from pyspark .pandas .series import Series
34323432
34333433 if not isinstance (cond , (DataFrame , Series )):
3434- raise ValueError ("type of cond must be a DataFrame or Series" )
3434+ raise TypeError ("type of cond must be a DataFrame or Series" )
34353435
34363436 cond_inversed = cond ._apply_series_op (lambda kser : ~ kser )
34373437 return self .where (cond_inversed , other )
@@ -3997,7 +3997,7 @@ def insert(
39973997 assert allow_duplicates is False
39983998
39993999 if not is_name_like_value (column ):
4000- raise ValueError (
4000+ raise TypeError (
40014001 '"column" should be a scalar value or tuple that contains scalar values'
40024002 )
40034003
@@ -4289,7 +4289,7 @@ def round(self, decimals=0) -> "DataFrame":
42894289 elif isinstance (decimals , int ):
42904290 decimals = {k : decimals for k in self ._internal .column_labels }
42914291 else :
4292- raise ValueError ("decimals must be an integer, a dict-like or a Series" )
4292+ raise TypeError ("decimals must be an integer, a dict-like or a Series" )
42934293
42944294 def op (kser ):
42954295 label = kser ._column_label
@@ -5660,7 +5660,7 @@ def clip(self, lower: Union[float, int] = None, upper: Union[float, int] = None)
56605660 will output the original DataFrame, simply ignoring the incompatible types.
56615661 """
56625662 if is_list_like (lower ) or is_list_like (upper ):
5663- raise ValueError (
5663+ raise TypeError (
56645664 "List-like value are not supported for 'lower' and 'upper' at the " + "moment"
56655665 )
56665666
@@ -5941,20 +5941,20 @@ def pivot_table(
59415941 small 5.5 2.333333 17 13
59425942 """
59435943 if not is_name_like_value (columns ):
5944- raise ValueError ("columns should be one column name." )
5944+ raise TypeError ("columns should be one column name." )
59455945
59465946 if not is_name_like_value (values ) and not (
59475947 isinstance (values , list ) and all (is_name_like_value (v ) for v in values )
59485948 ):
5949- raise ValueError ("values should be one column or list of columns." )
5949+ raise TypeError ("values should be one column or list of columns." )
59505950
59515951 if not isinstance (aggfunc , str ) and (
59525952 not isinstance (aggfunc , dict )
59535953 or not all (
59545954 is_name_like_value (key ) and isinstance (value , str ) for key , value in aggfunc .items ()
59555955 )
59565956 ):
5957- raise ValueError (
5957+ raise TypeError (
59585958 "aggfunc must be a dict mapping from column name "
59595959 "to aggregate functions (string)."
59605960 )
@@ -6031,7 +6031,7 @@ def pivot_table(
60316031 .agg (* agg_cols )
60326032 )
60336033 else :
6034- raise ValueError ("index should be a None or a list of columns." )
6034+ raise TypeError ("index should be a None or a list of columns." )
60356035
60366036 if fill_value is not None and isinstance (fill_value , (int , float )):
60376037 sdf = sdf .fillna (fill_value )
@@ -7940,7 +7940,7 @@ def append(
79407940 3 3 4
79417941 """
79427942 if isinstance (other , ps .Series ):
7943- raise ValueError ("DataFrames.append() does not support appending Series to DataFrames" )
7943+ raise TypeError ("DataFrames.append() does not support appending Series to DataFrames" )
79447944 if sort :
79457945 raise NotImplementedError ("The 'sort' parameter is currently not supported" )
79467946
@@ -10726,7 +10726,7 @@ def quantile(
1072610726 raise NotImplementedError ('axis should be either 0 or "index" currently.' )
1072710727
1072810728 if not isinstance (accuracy , int ):
10729- raise ValueError (
10729+ raise TypeError (
1073010730 "accuracy must be an integer; however, got [%s]" % type (accuracy ).__name__
1073110731 )
1073210732
@@ -10735,7 +10735,7 @@ def quantile(
1073510735
1073610736 for v in q if isinstance (q , list ) else [q ]:
1073710737 if not isinstance (v , float ):
10738- raise ValueError (
10738+ raise TypeError (
1073910739 "q must be a float or an array of floats; however, [%s] found." % type (v )
1074010740 )
1074110741 if v < 0.0 or v > 1.0 :
@@ -10904,9 +10904,9 @@ def query(self, expr, inplace=False) -> Optional["DataFrame"]:
1090410904 0 1 10 10
1090510905 """
1090610906 if isinstance (self .columns , pd .MultiIndex ):
10907- raise ValueError ("Doesn't support for MultiIndex columns" )
10907+ raise TypeError ("Doesn't support for MultiIndex columns" )
1090810908 if not isinstance (expr , str ):
10909- raise ValueError (
10909+ raise TypeError (
1091010910 "expr must be a string to be evaluated, {} given" .format (type (expr ).__name__ )
1091110911 )
1091210912 inplace = validate_bool_kwarg (inplace , "inplace" )
@@ -11012,7 +11012,7 @@ class max_speed
1101211012 """
1101311013 axis = validate_axis (axis )
1101411014 if not is_list_like (indices ) or isinstance (indices , (dict , set )):
11015- raise ValueError ("`indices` must be a list-like except dict or set" )
11015+ raise TypeError ("`indices` must be a list-like except dict or set" )
1101611016 if axis == 0 :
1101711017 return cast (DataFrame , self .iloc [indices , :])
1101811018 else :
@@ -11098,7 +11098,7 @@ def eval(self, expr, inplace=False) -> Optional[Union["DataFrame", "Series"]]:
1109811098 from pyspark .pandas .series import first_series
1109911099
1110011100 if isinstance (self .columns , pd .MultiIndex ):
11101- raise ValueError ("`eval` is not supported for multi-index columns" )
11101+ raise TypeError ("`eval` is not supported for multi-index columns" )
1110211102 inplace = validate_bool_kwarg (inplace , "inplace" )
1110311103 should_return_series = False
1110411104 series_name = None
@@ -11179,7 +11179,7 @@ def explode(self, column) -> "DataFrame":
1117911179 from pyspark .pandas .series import Series
1118011180
1118111181 if not is_name_like_value (column ):
11182- raise ValueError ("column must be a scalar" )
11182+ raise TypeError ("column must be a scalar" )
1118311183
1118411184 kdf = DataFrame (self ._internal .resolved_copy ) # type: "DataFrame"
1118511185 kser = kdf [column ]
0 commit comments