I'm hoping to find an answer to an issue I'm facing. I am currently trying to scrape financial data for a project and am in the final step of creating a DataFrame to store my data for downstream manipulation.
My issue is that I have created a dictionary of key value pairs, where the key is a company symbol, and the value pair is a list that contains a nested dictionary of key value pairs which correspond to the market data of that company. Below is an example of the raw data.
{'MMM': [{'Market Cap': '102.234B'},
{'Beta (5Y Monthly)': '0.95'},
{'PE Ratio (TTM)': '19.09'},
{'EPS (TTM)': '9.25'},
{'Earnings Date': 'Apr 26, 2021 - Apr 30, 2021'},
{'Forward Dividend & Yield': '5.92 (3.35%)'},
{'Ex-Dividend Date': 'Feb 11, 2021'},
{'1y Target Est': '183.43'}],
'AXP': [{'Market Cap': '106.104B'},
{'Beta (5Y Monthly)': '1.28'},
{'PE Ratio (TTM)': '34.94'},
{'EPS (TTM)': '3.77'},
{'Earnings Date': 'Apr 22, 2021 - Apr 26, 2021'},
{'Forward Dividend & Yield': '1.72 (1.31%)'},
{'Ex-Dividend Date': 'Jan 07, 2021'},
{'1y Target Est': '130.32'}],
'AMGN': [{'Market Cap': '133.816B'},
{'Beta (5Y Monthly)': '0.73'},
{'PE Ratio (TTM)': '18.82'},
{'EPS (TTM)': '12.31'},
I have tried to create a DataFrame using .from_dict and an index orientation but this is the result I get..
0 1 2 3 4 5 6 7
MMM {'Market Cap': '102.234B'} {'Beta (5Y Monthly)': '0.95'} {'PE Ratio (TTM)': '19.09'} {'EPS (TTM)': '9.25'} {'Earnings Date': 'Apr 26, 2021 - Apr 30, 2021'} {'Forward Dividend & Yield': '5.92 (3.35%)'} {'Ex-Dividend Date': 'Feb 11, 2021'} {'1y Target Est': '183.43'}
AXP {'Market Cap': '106.104B'} {'Beta (5Y Monthly)': '1.28'} {'PE Ratio (TTM)': '34.94'} {'EPS (TTM)': '3.77'} {'Earnings Date': 'Apr 22, 2021 - Apr 26, 2021'} {'Forward Dividend & Yield': '1.72 (1.31%)'} {'Ex-Dividend Date': 'Jan 07, 2021'} {'1y Target Est': '130.32'}
AMGN {'Market Cap': '133.816B'} {'Beta (5Y Monthly)': '0.73'} {'PE Ratio (TTM)': '18.82'} {'EPS (TTM)': '12.31'} {'Earnings Date': 'Apr 28, 2021 - May 03, 2021'} {'Forward Dividend & Yield': '7.04 (3.04%)'} {'Ex-Dividend Date': 'Feb 11, 2021'} {'1y Target Est': '254.20'}
How would I go about extracting the key/value pairs, such that the keys are the column names and the values are the datapoints? Any help would be appreciated... thanks