Created
June 15, 2021 13:43
-
-
Save joaomacalos/a28e87a1c2f0cc7d47309a8fe6ea0e50 to your computer and use it in GitHub Desktop.
Comparison-Python1
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
| # Load required libraries | |
| import pandas as pd | |
| import seaborn as sns | |
| import matplotlib.pyplot as plt | |
| # Read csv | |
| commodities = pd.read_csv('../../../Datasets/imf-commodities.csv') | |
| # Data wrangling | |
| commodities = ( | |
| commodities | |
| .loc[3:, ['Commodity', 'PALLFNF']] | |
| .dropna() | |
| .assign( | |
| date=lambda x: pd.to_datetime(x.Commodity, format='%YM%m'), | |
| comm=lambda x: x.PALLFNF.astype('float') | |
| ) | |
| ) | |
| commodities.head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment