728x90
In [1]:
import matplotlib.pyplot as plt
import pandas as pd
import datetime
In [2]:
# data
crypto_dict = {'allocation': [20,55,5,17,3]}
explode = (0,0,0,0.2,0)
In [3]:
crypto_df = pd.DataFrame(data= crypto_dict, index=['BTC','ETH','LTC','XRP','ADA'])
crypto_df
Out[3]:
allocation | |
---|---|
BTC | 20 |
ETH | 55 |
LTC | 5 |
XRP | 17 |
ADA | 3 |
In [4]:
# a pie chart
crypto_df.plot.pie(y = 'allocation',explode = explode, figsize = (8,8))
plt.title('crypto Portfolio Pi')
Out[4]:
Text(0.5, 1.0, 'crypto Portfolio Pi')
728x90
'Data Analytics with python > [Data Analysis]' 카테고리의 다른 글
[matplotlib]S5_appendix_Making_dataset(주식 일별 수익률 계산) (0) | 2023.01.21 |
---|---|
[matplotlib]S5_07_histogram (0) | 2023.01.21 |
[matplotlib]S5_05_Scatterplot (0) | 2023.01.21 |
[matplotlib]S5_04_Sub_plots (0) | 2023.01.21 |
[matplotlib]S5_03_Multiple_plots (0) | 2023.01.21 |
댓글