0

我正在尝试在下面的数据帧上绘制马赛克图,但它不断发送错误:'ValueError:至少一个比例应该大于零'这里是数据帧:

import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
from statsmodels.graphics.mosaicplot import mosaic
Mortgage = [3839, 950]
Own = [1170, 183]
Rent = [3496, 362]
data = pd.DataFrame({'Mortgage' : Mortgage, 'Own' :Own, 'Rent': Rent})
mosaic(data, ['Mortgage', 'Own', 'Rent'])
plt.show()

有什么想法吗?谢谢

4

0 回答 0