0

I am trying to plot scatter plots from a pandas dataframe groupby object while trying to use values from a second dataframe of identical shape for error bars. Here is the code I used:

for key, group in results_new_mean_gal.groupby("Donor"):

    Y_error = results_new_CV_gal.groupby("Donor")

    group.iplot(subplots = True, subplot_titles = True, legend =False, x="Time", kind="scatter", mode="lines+markers", error_y=Y_error.get_group(key), error_type="data")

I am getting the following error: Plotly ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

I am looking for help in understanding what this error means and how I should try to eliminate it. Thanks!

Here is the dataframe with values for plotting, named "results_new_mean_gal":

GalCer(d18:0/16:0)  GalCer(d18:0/18:0)  GalCer(d18:0/20:0)  GalCer(d18:0/22:0)  GalCer(d18:1/12:0)  GalCer(d18:1/16:0)  GalCer(d18:1/18:0)  GalCer(d18:1/18:1)  GalCer(d18:1/20:0)  GalCer(d18:1/20:1)  ... GalCer(d18:1/26:0)  GalCer(d18:1/26:1)  GalCer(d18:2/18:0)  GalCer(d18:2/20:0)  GalCer(d18:2/24:0)  GalCer(d20:1/18:0)  GalSph(d18:1)-d5_287_Fragment   GalSph(d18:1)_282_Fragment  Donor   Time
0   0.215300    0.059700    0.070194    0.363689    0.0 14.116016   1.152977    

0.076444    1.755010    0.065237    ... 0.367733    0.397030    0.216907    
0.370995    2.363961    0.057962    0.0 54.771683   1945    0.0
1   0.231123    0.062481    0.077622    0.485070    0.0 10.033995   1.157515    
0.073333    0.368644    0.064531    ... 0.420362    0.239777    0.248076    
0.464601    2.715882    0.058266    0.0 54.953925   1945    24.0
2   0.201798    0.063592    0.102606    0.525483    0.0 15.053302   1.228159    
0.070733    1.183602    0.073261    ... 0.363202    0.411757    0.347854    
0.431674    2.998217    0.057020    0.0 54.579375   1945    168.0
3   0.328857    0.063406    0.095548    0.525920    0.0 13.270539   0.658445    
0.084318    1.276229    0.071935    ... 0.383221    0.236308    0.144282    
0.382030    3.332633    0.060944    0.0 54.716536   1945    336.0
4   0.217867    0.059378    0.077878    0.571903    0.0 12.489410   0.846313    
0.084687    1.693159    0.080074    ... 0.290250    0.300206    0.183519    
0.374895    2.723848    0.061060    0.0 54.521497   1945    672.0

And the following dataframe contains values for error bars, named "results_new_CV_gal":

GalCer(d18:0/16:0)  GalCer(d18:0/18:0)  GalCer(d18:0/20:0)  
GalCer(d18:0/22:0)  GalCer(d18:1/12:0)  GalCer(d18:1/16:0)  
GalCer(d18:1/18:0)  GalCer(d18:1/18:1)  GalCer(d18:1/20:0)  
GalCer(d18:1/20:1)  ... GalCer(d18:1/26:0)  GalCer(d18:1/26:1)  
GalCer(d18:2/18:0)  GalCer(d18:2/20:0)  GalCer(d18:2/24:0)  
GalCer(d20:1/18:0)  GalSph(d18:1)-d5_287_Fragment   
GalSph(d18:1)_282_Fragment  Donor   Time
0   0.334065    0.074880    0.027869    0.555201    NaN 0.005897    0.173130    

0.064572    1.156563    0.047950    ... 0.373245    0.266474    0.309391    
0.431493    0.340852    0.075503    NaN 0.005365    1945    0.0
1   0.079276    0.180951    0.083804    0.730536    NaN 0.082057    0.649561    

0.019622    0.327917    0.018683    ... 0.059414    0.340055    0.021224    
0.114184    0.192853    0.012973    NaN 0.004639    1945    24.0
2   0.137435    0.120870    0.414772    0.183564    NaN 0.103133    0.297932    

0.154821    0.116996    0.145507    ... 0.274355    0.311000    0.221077    
0.080608    0.117676    0.053936    NaN 0.000666    1945    168.0
3   0.388812    0.176556    0.263537    0.387674    NaN 0.208829    0.727563    

0.024587    1.096352    0.092637    ... 0.554185    0.430230    0.725164    
0.057672    0.027661    0.125046    NaN 0.000696    1945    336.0
4   0.140836    0.012758    0.230036    0.227757    NaN 0.068854    0.203473    

0.351434    0.436528    0.278715    ... 0.186993    0.041627    0.385178    
0.323510    0.099012    0.019424    NaN 0.000509    1945    672.0
kkhatri99
  • 866
  • 3
  • 9
  • 17

0 Answers0