What’s the biggest difference between dir() and __dict__ in Python

class C(object): def f(self): print self.__dict__ print dir(self) c = C() c.f() output: {} ['__class__', '__delattr__','f',….] why there is not a ‘f’ in self.__dict__ Answers: Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If … Read more

How to determine if object is a valid key-value pair in PySpark

If I have a rdd, how do I understand the data is in key:value format? is there a way to find the same – something like type(object) tells me an object’s type. I tried print type(rdd.take(1)), but it just says <type ‘list’>. Let’s say I have a data like (x,1),(x,2),(y,1),(y,3) and I use groupByKey and … Read more