This is a small part of the data that needs to get in a barchart and the code I tried it with. But the parentheses and the "," instead of ":" within the parentheses make it that it is not possible in any ways I know how to get it done. ( I want to make a bar chart that shows the times a link shows like: 'http://www.wikidata.org/entity/Q31855 5, 'http://www.wikidata.org/entity/Q5' , 24.)
a_dictionary = {'class vs. total number of instances of the class': [('http://www.wikidata.org/entity/Q31855',
5),
('http://www.wikidata.org/entity/Q5', 24),
('http://www.wikidata.org/entity/Q9388534', 25)],
'property vs. total number of distinct objects in triples using the property': [('http://www.wikidata.org/prop/direct/P800',
1),
('https://w3id.org/artchives/wikidataReconciliation', 1),
('http://www.w3.org/ns/prov#wasInfluencedBy', 2),
('https://w3id.org/artchives/publicationStage', 2),
('https://w3id.org/artchives/hasSecondLink', 2)]}
keys = a_dictionary.keys()
values = a_dictionary.values()
plt.bar(keys, values)
And this is the error that comes with it:
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('<U39') dtype('<U39') dtype('<U39')
Does anybody have an idea to make a bar chart with this type of data?
If I use the code that someone suggested in the comments I get an error and I think that the reason for that are the () around the links and the number, and beceause there are ',' instead of ':' between the keys and the values. Does anyone have a solution?