I have a basic (almost naive) question for plotting on top of a pandas df. Given the df below I am trying to do a stack bar plot for ‘stats_value’ and ‘read1_length’ v/s ‘lib_name’.
temp1=
parent_library_name lib_name stats_value read1_length
58 None CXYY 106 150
311 CXYY CSGW 128 150
432 CXYY CSNS 109 150
552 CXYY CXPS 125 150
671 CXYY CXOA 123 150
1113 CXYY CXOC 108 150
1394 CXYY CXOO 129 150
1675 CXYY CXOP 101 150
1794 CXYY CXSP 132 150
1914 CXYY CXOY 116 150
2356 CXYY CXSO 69 150
2635 CXYY CSHT 77 150
2914 CXYY CXSU 76 150
Tried the following things:
c=temp1.set_index('lib_name')
c[['stats_value','read1_length']].plot(kind='bar',stacked=True)
Error:
TypeError: unsupported operand type(s) for +: 'numpy.float64' and 'str'
Tried something simple just to test:
c=temp1.set_index('lib_name')
c[['stats_value']].plot()
Error:
AttributeError: 'numpy.ndarray' object has no attribute 'find'
So I think I am missing some trick here.
Best,
-Abhi
dtype of the stats_value was not correct …plotting works again..
-A