Created
May 31, 2026 16:19
-
-
Save ram1123/6fa067e78a12138bf62b23b0e9ce0184 to your computer and use it in GitHub Desktop.
awakward_copy.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import awkward as ak | |
| events = ak.Array([ | |
| {"Muon": [{"pt": 10.0}, {"pt": 20.0}]}, | |
| {"Muon": [{"pt": 30.0}]}, | |
| ]) | |
| print("Original pt:") | |
| print(events.Muon.pt) | |
| # Save pt_raw from pt | |
| events["Muon", "pt_raw"] = events.Muon.pt | |
| print("\nAfter pt_raw = pt:") | |
| print("pt :", events.Muon.pt) | |
| print("pt_raw :", events.Muon.pt_raw) | |
| # Replace pt with a new array | |
| events["Muon", "pt"] = events.Muon.pt + 100 | |
| print("\nAfter replacing pt:") | |
| print("pt :", events.Muon.pt) | |
| print("pt_raw :", events.Muon.pt_raw) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment