python 我们如何将两个dataframe列加载到folium中的弹出窗口中?

tpxzln5u  于 2023-05-21  发布在  Python
关注(0)|答案(1)|浏览(100)

我有一个看起来像这样的数据集。

Procedure   Code_Type   Code    NDC Rev_Code    Procedure_Description   Payer   Plan(s) IP_Price    OP_Price    Discounted_Cash_Price   IP_Negotiated_Charge    OP_Negotiated_Charge    PB_Negotiated_Charge    De-Identified_Minimum_Negotiated_Charge_(IP)    De-Identified_Maximum_Negotiated_Charge_(IP)    De-Identified_Minimum_Negotiated_Charge_(OP)    De-Identified_Maximum_Negotiated_Charge_(OP)    ID  hospital_name   lat lon
7509657101  EAP 96571           BRONCHOSCOPY WITH PHOTODYNAMIC THERAPY EACH ADDITIONAL 15 MINUTES   1199 NATIONAL BENEFIT FUND [5140]   1199SEIU BENEFIT FUND [514001]  1,073.73    1,073.73    429.49      32              29.82   697.92  36  Atlanta Center for Medical Research, Atlanta, GA, USA   33.739876   -84.512581
7710001A01  EAP CPT® 0001A     0771 - PREVENTIVE CARE SERVICES - VACCINE ADMINISTRATION    IMM ADMN SARSCOV2 30MCG/0.3ML DIL RECON 1ST DOSE    1199 NATIONAL BENEFIT FUND [5140]   1199SEIU BENEFIT FUND [514001]  100 100 0       40              16.94   80  41  Synergy Spinecare & Rehabilitation Medicine, Teaneck, NJ, USA   40.873272   -74.012093
7710001A01  EAP CPT® 0001A     0771 - PREVENTIVE CARE SERVICES - VACCINE ADMINISTRATION    IMM ADMN SARSCOV2 30MCG/0.3ML DIL RECON 1ST DOSE    AETNA COMM [5020]   MERITAIN HEALTH [502006]    42.35   42.35   0       29.65               16.94   80  9   Massachusetts General Hospital, Boston, MS, USA 42.3624 -71.069206
7710002A01  EAP CPT® 0002A     0771 - PREVENTIVE CARE SERVICES - VACCINE ADMINISTRATION    IMM ADMN SARSCOV2 30MCG/0.3ML DIL RECON 2ND DOSE    1199 NATIONAL BENEFIT FUND [5140]   1199SEIU BENEFIT FUND [514001]  100 100 0       40              20  80  26  Forest Hills Medical Services, Queens, NYC, NY, USA 40.73431    -73.84951
7710002A01  EAP CPT® 0002A     0771 - PREVENTIVE CARE SERVICES - VACCINE ADMINISTRATION    IMM ADMN SARSCOV2 30MCG/0.3ML DIL RECON 2ND DOSE    AETNA COMM [5020]   MERITAIN HEALTH [502006]    70.73   70.73   0       49.51               20  80  21  Park Avenue Smiles, Yonkers, NYC, NY, USA   40.945873   -73.890671
7710011A01  EAP CPT® 0011A     0771 - PREVENTIVE CARE SERVICES - VACCINE ADMINISTRATION    IMM ADMN SARSCOV2 100 MCG/0.5 ML 1ST DOSE   1199 NATIONAL BENEFIT FUND [5140]   1199SEIU BENEFIT FUND [514001]  100 100 0       40              16.94   80  17  New York’s Presbyterian Lower Manhattan Hospital, NYC, NY, USA  40.710255   -74.005058
7710011A01  EAP CPT® 0011A     0771 - PREVENTIVE CARE SERVICES - VACCINE ADMINISTRATION    IMM ADMN SARSCOV2 100 MCG/0.5 ML 1ST DOSE   AETNA COMM [5020]   MERITAIN HEALTH [502006]    42.35   42.35   0       29.65               16.94   80  50  Baptist East Hospital, Memphis, TN, USA 35.2005 -89.788216
7710012A01  EAP CPT® 0012A     0771 - PREVENTIVE CARE SERVICES - VACCINE ADMINISTRATION    IMM ADMN SARSCOV2 100 MCG/0.5 ML 2ND DOSE   1199 NATIONAL BENEFIT FUND [5140]   1199SEIU BENEFIT FUND [514001]  100 100 0       40              20  80  29  Brooklyn Abortion Clinic, Brooklyn, NY, New York, USA   40.689743   -73.982368
7710012A01  EAP CPT® 0012A     0771 - PREVENTIVE CARE SERVICES - VACCINE ADMINISTRATION    IMM ADMN SARSCOV2 100 MCG/0.5 ML 2ND DOSE   AETNA COMM [5020]   MERITAIN HEALTH [502006]    70.73   70.73   0       49.51               20  80  50  Baptist East Hospital, Memphis, TN, USA 35.2005 -89.788216
3100015M01  EAP CPT® 0015M     0310 - LABORATORY PATHOLOGICAL - GENERAL CLASSIFICATION ADRENAL CORTICAL TUMOR, BIOCHEMICAL ASSAY OF 25 STEROID MARKERS, UTILIZING  1199 NATIONAL BENEFIT FUND [5140]   1199SEIU BENEFIT FUND [514001]  1   1   0       0.85                0.01    0.85    34  UC Physicians Medical Arts Building, Cincinnati, Ohio, USA  39.136597   -84.505058

现在,我正在尝试创建一个显示纬度和经度的foilumMap,以及我的数据框中的两列。
这是我的代码。

from folium.plugins import MarkerCluster

m = folium.Map(location=[40.74, -73.98], zoom_start=10)

for i in range(0,len(df_final)):
    folium.Marker([df_final['lat'].iloc[i],df_final['lon'].iloc[i]],
            popup=df_final[['hospital_name','Discounted_Cash_Price']]).add_to(m)
        
m

当我运行它时,我得到这个。

似乎有很多很多多余的信息 Package 在这里。我期待着一个刺痛医院名称和一个浮动折扣现金价格,但我得到了很多很多额外的东西。可能数据集没有被正确解析。这里能出什么问题?

cyvaqqii

cyvaqqii1#

我能搞定的。

m = folium.Map(location=[40.74, -73.98], zoom_start=10)

for i in range(0,len(df_final)):
    folium.Marker([df_final['lat'].iloc[i],df_final['lon'].iloc[i]],
            popup = "Hospital: " + str(df_final.hospital_name[i]) + '<br>' +
                    "Price: " + str(df_final.Discounted_Cash_Price[i])).add_to(m)
       
m

相关问题