Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How to convert a spreadsheet to Python dictionary?
The easiest way to convert a spreadsheet to Python dictionary is to use an external library like pandas. This provides very helpful features like to_dict on excel objects. You can use these like −
Example
from pandas import *
xls = ExcelFile('my_file.xls')
data = xls.parse(xls.sheet_names[0])
print(data.to_dict())
Output
This will give the output −
{'id': 10, 'name': "John"} Advertisements
