We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 19ff361 commit 4b77d38Copy full SHA for 4b77d38
pandas/core/indexing.py
@@ -444,6 +444,26 @@ def loc(self) -> _LocIndexer:
444
viper 0 0
445
sidewinder 0 0
446
447
+ Add value matching location
448
+
449
+ >>> df.loc["viper", "shield"] += 5
450
+ >>> df
451
+ max_speed shield
452
+ cobra 30 10
453
+ viper 0 5
454
+ sidewinder 0 0
455
456
+ Setting using a ``Series`` or a ``DataFrame`` sets the values matching the
457
+ index labels, not the index positions.
458
459
+ >>> shuffled_df = df.loc[["viper", "cobra", "sidewinder"]]
460
+ >>> df.loc[:] += shuffled_df
461
462
463
+ cobra 60 20
464
+ viper 0 10
465
466
467
**Getting values on a DataFrame with an index that has integer labels**
468
469
Another example using integers for the index
0 commit comments