What I expected to happen:
As per my understanding above code should create tag_count DataFrame with 2 columns, named ‘tag’ and ‘count’; ‘tag’ column should be populated with the keys from tag_count dictionary and ‘count’ column should be populated with data from key-values from the dictionary.
What actually happened:
But am getting the following error:
TypeErrorTraceback (most recent call last)
<ipython-input-8-f03d0c393b77> in <module>()
1 tag_count = pd.DataFrame.from_dict(tag_count, orient='index',
----> 2 columns=['tag', 'count'])
3 tag_count
TypeError: from_dict() got an unexpected keyword argument 'columns'
Hi…
Thanks for replying.
Earlier, using the ‘columns’ attribute in DataFrame.from_dict() was throwing the error shown above. But renaming the columns worked just fine and I was able to proceed.
Though, am not getting the error anymore and both the methods are working just fine.