Created
February 1, 2018 02:46
-
-
Save leleofg/9ceafa8480526cf29b8c5dfde5876dc8 to your computer and use it in GitHub Desktop.
Pandas Discount
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 pandas as pd | |
| purchase_1 = pd.Series({'Name': 'Chris', | |
| 'Item Purchased': 'Dog Food', | |
| 'Cost': 22.50}) | |
| purchase_2 = pd.Series({'Name': 'Kevyn', | |
| 'Item Purchased': 'Kitty Litter', | |
| 'Cost': 2.50}) | |
| purchase_3 = pd.Series({'Name': 'Vinod', | |
| 'Item Purchased': 'Bird Seed', | |
| 'Cost': 5.00}) | |
| df = pd.DataFrame([purchase_1, purchase_2, purchase_3], index=['Store 1', 'Store 1', 'Store 2']) | |
| df['Cost'] *= 0.8 | |
| print(df) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment