aboutsummaryrefslogtreecommitdiff
path: root/src/ee/digikey
diff options
context:
space:
mode:
Diffstat (limited to 'src/ee/digikey')
-rw-r--r--src/ee/digikey/__init__.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ee/digikey/__init__.py b/src/ee/digikey/__init__.py
index 957aa40..d1664e2 100644
--- a/src/ee/digikey/__init__.py
+++ b/src/ee/digikey/__init__.py
@@ -115,6 +115,16 @@ class DigikeyProduct(object):
attributes[key] = value
return c
+ def _to_pandas_dict(self):
+ value = {
+ "MPN": self.mpn,
+ "Digi-Key": self.part_number,
+ "URL": self.url,
+ }
+ for a in self.attributes:
+ value[a.attribute_type.label] = a.value
+ return value
+
from_ini_r = re.compile("([^/]*)/(.*)")
@staticmethod
@@ -362,3 +372,10 @@ class DigikeyRepository(object):
for p in self.products:
if p.mpn == mpn:
return p
+
+ def to_pandas(self):
+ import pandas
+
+ data = [part._to_pandas_dict() for part in self.products]
+ index = [part.mpn for part in self.products]
+ return pandas.DataFrame(data=data, index=index)