{ "cells": [ { "cell_type": "markdown", "id": "45e5a76a-107c-4684-9b0f-26599138e5ab", "metadata": {}, "source": [ "# Portfolio Panic: A Wealth Manager's Conundrum \n", "\n", "### Description: \n", "Imagine you're a wealth manager at a prestigious financial firm, responsible for managing a vast portfolio of stocks, bonds, and assets for high-net-worth clients. Your team relies on data analysis to make informed investment decisions, but your current dataset is a mess! You need to wrangle the data to identify trends, improve performance, and mitigate risk. Can you use your Pandas skills to tame the data beast and save the day? \n", "\n", "### Tasks: \n", "- **Asset Allocation Analysis:** Identify the top 5 asset classes by total value and calculate their respective weights in the portfolio.\n", "- **Risk Management:** Find the stocks with the highest volatility (highest values in the \"Volatility\" column) and calculate their average returns.\n", "- **Performance Optimization:** Group the data by sector and calculate the average returns for each sector. Identify the top 3 sectors with the highest returns." ] }, { "cell_type": "code", "execution_count": 1, "id": "e832a7fc-164e-4d93-80b9-5f275eb8b3c8", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Python version 3.11.7 | packaged by Anaconda, Inc. | (main, Dec 15 2023, 18:05:47) [MSC v.1916 64 bit (AMD64)]\n", "Pandas version 2.2.1\n", "Numpy version 1.26.4\n" ] } ], "source": [ "# import libraries\n", "import pandas as pd\n", "import numpy as np\n", "import sys\n", "\n", "print('Python version ' + sys.version)\n", "print('Pandas version ' + pd.__version__)\n", "print('Numpy version ' + np.__version__)" ] }, { "cell_type": "markdown", "id": "48c842c1-4ae1-4bc7-bda0-d53820d7b8e4", "metadata": {}, "source": [ "# The Data \n", "\n", "The dataset represents a portfolio of assets, including stocks, bonds, and other investment vehicles with information on their sector, value, returns, and volatility. It consists of 1000 rows, with each row representing a single asset and its corresponding attributes.\n", "\n", "### Columns: \n", "- **Asset Class:** The type of asset (Stocks, Bonds, Real Estate, Commodities, Currencies) \n", "- **Sector:** The industry sector (Technology, Finance, Healthcare, Energy, Consumer Goods) \n", "- **Stock Symbol:** The stock symbol (AAPL, MSFT, JPM, GOOG, AMZN) \n", "- **Value:** The current value of the asset \n", "- **Returns:** The historical returns of the asset \n", "- **Volatility:** The historical volatility of the asset \n", "\n", "Can you tame the data and help the wealth manager make informed investment decisions?" ] }, { "cell_type": "code", "execution_count": 2, "id": "afa72db0-119c-4272-8dee-0c08b81af6b4", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | Asset Class | \n", "Sector | \n", "Stock Symbol | \n", "Value | \n", "Returns | \n", "Volatility | \n", "
---|---|---|---|---|---|---|
0 | \n", "Currencies | \n", "Energy | \n", "AAPL | \n", "27148.447388 | \n", "0.080532 | \n", "0.206389 | \n", "
1 | \n", "Stocks | \n", "Technology | \n", "AMZN | \n", "47770.455686 | \n", "0.152416 | \n", "0.225218 | \n", "
2 | \n", "Commodities | \n", "Healthcare | \n", "MSFT | \n", "81326.560992 | \n", "0.074461 | \n", "0.469665 | \n", "
3 | \n", "Commodities | \n", "Consumer Goods | \n", "AAPL | \n", "81746.141057 | \n", "-0.027992 | \n", "0.483869 | \n", "
4 | \n", "Commodities | \n", "Finance | \n", "MSFT | \n", "75283.975516 | \n", "0.058908 | \n", "0.139532 | \n", "
\n", " | avg_volatility | \n", "avg_returns | \n", "
---|---|---|
Stock Symbol | \n", "\n", " | \n", " |
AAPL | \n", "0.292839 | \n", "0.041167 | \n", "
AMZN | \n", "0.290529 | \n", "0.044325 | \n", "
GOOG | \n", "0.306020 | \n", "0.041320 | \n", "
JPM | \n", "0.302877 | \n", "0.051169 | \n", "
MSFT | \n", "0.289748 | \n", "0.054646 | \n", "
This tutorial was created by HEDARO
" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.7" } }, "nbformat": 4, "nbformat_minor": 5 }