Créé en référence à
Convertissez un PDF des détails de la répartition de la plainte en csv avec pdfplumber et visualisez-le Détail des plaintes des compagnies d'assurance-vie
import requests
from bs4 import BeautifulSoup
url = "https://www.seiho.or.jp/member/complaint/"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko"
}
r = requests.get(url, headers=headers)
r.raise_for_status()
soup = BeautifulSoup(r.content, "html.parser")
result = []
for tag in soup.select("div.headMod04.mt30"):
data = []
data.append(tag.h3.get_text(strip=True).replace("Co., Ltd.", ""))
for table in tag.find_next_siblings("table", class_=["mt10", "mt15"], limit=2):
for td in table.select("tr > td.taR"):
f = float(td.get_text(strip=True).rstrip("matière%").replace(",", ""))
data.append(int(f) if f.is_integer() else f)
result.append(data)
import pandas as pd
df = pd.DataFrame(
result,
columns=[
"Nom de la compagnie d'assurance",
"Nombre de plaintes",
"Nouvelle relation contractuelle",
"Liés au stockage",
"Relations de conservation",
"Argent d'assurance",
"Autre",
"Nombre de contrats en vigueur",
"Nombre de clients",
],
).set_index("Nom de la compagnie d'assurance")
df
Nom de la compagnie d'assurance | Nombre de plaintes | Nouvelle relation contractuelle | Liés au stockage | Relations de conservation | Argent d'assurance | Autre | Nombre de contrats en vigueur | Nombre de clients | Taux de réclamation |
---|---|---|---|---|---|---|---|---|---|
Assurance vie Axa | 4909 | 12.9 | 5.9 | 19.5 | 22.2 | 39.4 | 4.76064e+06 | 2.58086e+06 | 0.00190208 |
Assurance vie directe AXA | 102 | 39.2 | 11.8 | 16.7 | 19.6 | 12.7 | 159640 | 120100 | 0.000849292 |
Compagnie d'assurance-vie Asahi | 2895 | 14.4 | 7.3 | 25.5 | 13.2 | 39.7 | 7.77216e+06 | 1.94576e+06 | 0.00148785 |
Assurance vie Aflac | 12699 | 22.9 | 12.8 | 27.4 | 24.8 | 12 | 2.43943e+07 | 1.52941e+07 | 0.000830322 |
Assurance vie Aeon Allianz | 11 | 0 | 0 | 0 | 100 | 0 | 16219 | 16219 | 0.000678217 |
Assurance vie SBI | 72 | 52.8 | 4.2 | 13.9 | 16.7 | 12.5 | 115621 | 102485 | 0.000702542 |
Assurance-vie NN | 163 | 8.6 | 15.3 | 49.1 | 14.1 | 12.9 | 504097 | 186308 | 0.000874895 |
Assurance vie FWD Fuji | 1098 | 22 | 12.4 | 11.1 | 24.3 | 30.1 | 1.4471e+06 | 1.07855e+06 | 0.00101803 |
Assurance vie ORIX | 6587 | 25 | 8.2 | 15.3 | 39.1 | 12.5 | 4.69599e+06 | 4.69599e+06 | 0.00140269 |
Assurance vie de Cardiff | 31 | 61.3 | 0 | 9.7 | 16.1 | 12.9 | 8891 | 1.33126e+06 | 2.32862e-05 |
Assurance vie Kanpo | 48859 | 87.9 | 1.4 | 5.2 | 4 | 1.4 | 1.79239e+07 | 1.0281e+07 | 0.00475235 |
Assurance vie Creddy Aglycol | 10 | 40 | 0 | 10 | 20 | 30 | 59089 | 52001 | 0.000192304 |
Assurance-vie Gibralta | 7783 | 4.8 | 13.4 | 42.6 | 22.5 | 16.7 | 6.41288e+06 | 6.41288e+06 | 0.00121365 |
Sumitomo Life Insurance Company | 11698 | 6.7 | 7.1 | 32.6 | 23.5 | 30 | 1.14377e+07 | 6.93738e+06 | 0.00168623 |
Sony Life Insurance | 3871 | 9.4 | 12.2 | 43.1 | 14.7 | 20.7 | 8.16556e+06 | 3.70221e+06 | 0.00104559 |
Sony Life avec assurance-vie | 200 | 12 | 0 | 58.5 | 7.5 | 22 | 99225 | 87701 | 0.00228048 |
SOMPO Sunflower Life Insurance (anciennement Sompo Japan Nipponkoa Sunflower Life Insurance) | 1268 | 13.5 | 13.8 | 29.8 | 25 | 17.9 | 4.19732e+06 | 2.9958e+06 | 0.000423259 |
Première assurance-vie | 5728 | 9.2 | 6.7 | 23.9 | 15.3 | 44.8 | 2.07372e+07 | 8.03565e+06 | 0.000712824 |
Assurance-vie First Frontier | 706 | 37.8 | 0 | 16.6 | 6.8 | 38.8 | 1.59389e+06 | 1.25441e+06 | 0.000562816 |
Taiki Life Insurance (anciennement Mitsui Life Insurance) | 2495 | 14.6 | 7.5 | 22.9 | 18.2 | 36.8 | 2.58049e+06 | 1.82014e+06 | 0.00137078 |
Assurance vie Daido | 1431 | 10.3 | 8.5 | 40 | 15.7 | 25.6 | 2.08751e+06 | 798324 | 0.00179251 |
Assurance vie solaire | 1328 | 30.6 | 8.1 | 22.1 | 17.6 | 21.6 | 7.69601e+06 | 2.03224e+06 | 0.000653466 |
Zurich Life Insurance Company Limited | 1794 | 29.1 | 16.1 | 18.5 | 10 | 26.3 | 1.17402e+06 | 993181 | 0.00180632 |
Assurance-vie T & D Financial | 170 | 19.4 | 5.9 | 40.6 | 21.8 | 12.4 | 329886 | 281942 | 0.000602961 |
Assurance vie Tokio Marine et Nichido Anshin | 2809 | 15.3 | 14.2 | 30 | 7.8 | 32.6 | 5.97493e+06 | 3.54450e+06 | 0.000792494 |
Nissei Wealth Life Insurance | 379 | 4.7 | 6.1 | 28.8 | 39.1 | 21.4 | 332853 | 274786 | 0.00137926 |
Japan Life Insurance Company | 9210 | 11.1 | 9.4 | 37.8 | 14.6 | 27 | 3.30507e+07 | 1.21611e+07 | 0.00075733 |
Assurance-vie Neo First | 299 | 36.5 | 10.7 | 14.4 | 22.4 | 16.1 | 379944 | 379944 | 0.000786958 |
Assurance vie Hanasaku | 86 | 52.3 | 15.1 | 7 | 16.3 | 9.3 | 74374 | 70904 | 0.00121291 |
Compagnie mutuelle d'assurance-vie Wealth | 2873 | 8.8 | 13.5 | 35.1 | 25 | 17.6 | 3.79431e+06 | 1.7536e+06 | 0.00163834 |
Assurance vie Fukoku Shinrai | 1300 | 2.5 | 6.5 | 13.7 | 16.2 | 61.2 | 591927 | 449197 | 0.00289405 |
Assurance vie prudentielle | 2055 | 19.2 | 12.9 | 40.7 | 12.6 | 14.5 | 4.181e+06 | 1.7134e+06 | 0.00119937 |
PGF Life (Prudental Gibralta Financial Life Insurance) | 826 | 17.4 | 8.2 | 38.1 | 17.1 | 19.1 | 584295 | 518397 | 0.00159337 |
Assurance vie Manuvie | 1089 | 7.3 | 13.1 | 19.2 | 17.1 | 43.3 | 1.56167e+06 | 1.04053e+06 | 0.00104658 |
Assurance vie Sumitomo Mitsui Marine Aioi | 765 | 15.6 | 10.1 | 17.1 | 31.2 | 26 | 3.91038e+06 | 3.91038e+06 | 0.000195633 |
Assurance vie primaire Sumitomo Mitsui Marine | 561 | 20 | 0 | 18.7 | 10.3 | 51 | 1.20054e+06 | 987210 | 0.000568268 |
Assurance vie verte | 174 | 63.8 | 4.6 | 7.5 | 13.8 | 10.3 | 249168 | 203418 | 0.000855382 |
Compagnie d'assurance-vie Meiji Yasuda | 7094 | 9.9 | 8.9 | 32.2 | 21.9 | 27.1 | 1.23014e+07 | 7.04229e+06 | 0.00100734 |
Assurance-vie Met Life | 10905 | 12 | 10.7 | 28 | 24.1 | 25.2 | 9.43914e+06 | 9.43914e+06 | 0.0011553 |
Assurance-vie Medicare | 388 | 33 | 19.6 | 14.9 | 20.6 | 11.9 | 778313 | 702099 | 0.000552629 |
Assurance vie Lifenet | 1114 | 54.7 | 7.9 | 6 | 8 | 23.4 | 387775 | 246432 | 0.00452052 |
Assurance vie Rakuten | 678 | 21.4 | 14.5 | 19.9 | 29.2 | 15 | 844748 | 499039 | 0.00135861 |
import japanize_matplotlib
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.rcParams["figure.dpi"] = 200
df["Nombre de plaintes"].plot.barh(figsize=(15, 15))
df["Taux de réclamation"] = df["Nombre de plaintes"] / df["Nombre de clients"]
df["Taux de réclamation"].plot.barh(figsize=(15, 15))
df1 = df.reindex(columns = ["Nouvelle relation contractuelle", "Liés au stockage", "Relations de conservation", "Argent d'assurance", "Autre"])
df1.plot.barh(stacked=True, figsize=(15, 15))
Recommended Posts