File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -8859,10 +8859,22 @@ def update(
8859
8859
other = DataFrame (other )
8860
8860
8861
8861
indexes_intersection = self .index .intersection (other .index )
8862
+ if not len (indexes_intersection ):
8863
+ raise ValueError (
8864
+ "Can't update dataframe when other has no element in common."
8865
+ )
8862
8866
8863
8867
for col in self .columns .intersection (other .columns ):
8864
- this = self .loc [indexes_intersection , col ]._values
8865
- that = other .loc [indexes_intersection , col ]._values
8868
+ this = self .loc [indexes_intersection , col ]
8869
+ that = other .loc [indexes_intersection , col ]
8870
+
8871
+ if this .index .has_duplicates or that .index .has_duplicates :
8872
+ raise ValueError (
8873
+ "Update not allowed with duplicate indexes on dataframe or other."
8874
+ )
8875
+
8876
+ this = this ._values
8877
+ that = that ._values
8866
8878
8867
8879
if filter_func is not None :
8868
8880
mask = ~ filter_func (this ) | isna (that )
You can’t perform that action at this time.
0 commit comments