def read(cls, data):
        """Reads data from URL, Dataframe, JSON string, JSON file or
           OrderedDict.
        Args:
            data: can be a Pandas Dataframe, a JSON file, a JSON string,
                  an OrderedDict or a URL pointing to a JSONstat file.

        Returns:
            An object of class Dataset populated with data.

        """
        if isinstance(data, pd.DataFrame):
            return cls((json.loads(
                to_json_stat(data, output='dict', version='2.0'),
                object_pairs_hook=OrderedDict)))
        elif isinstance(data, OrderedDict):
            return cls(data)
        elif (isinstance(data, basestring)
              and data.startswith(("http://", "https://",
                                   "ftp://", "ftps://"))):
            # requests will do the rest...
            return cls(request(data))
        elif isinstance(data, basestring):
            try:
                json_dict = json.loads(data, object_pairs_hook=OrderedDict)
                return cls(json_dict)
            except ValueError:
                raise
        else:
            try:
                json_dict = json.load(data, object_pairs_hook=OrderedDict)
                return cls(json_dict)
            except ValueError:
                raise
def read ( cls , data ) : if isinstance ( data , pd . DataFrame ) : return cls ( ( json . loads ( to_json_stat ( data , output = 'dict' , version = '2.0' ) , object_pairs_hook = OrderedDict ) ) ) elif isinstance ( data , OrderedDict ) : return cls ( data ) elif ( isinstance ( data , basestring ) and data . startswith ( ( "http://" , "https://" , "ftp://" , "ftps://" ) ) ) : return cls ( request ( data ) ) elif isinstance ( data , basestring ) : try : json_dict = json . loads ( data , object_pairs_hook = OrderedDict ) return cls ( json_dict ) except ValueError : raise else : try : json_dict = json . load ( data , object_pairs_hook = OrderedDict ) return cls ( json_dict ) except ValueError : raise
Reads data from URL, Dataframe, JSON string, JSON file or
           OrderedDict.
        Args:
            data: can be a Pandas Dataframe, a JSON file, a JSON string,
                  an OrderedDict or a URL pointing to a JSONstat file.

        Returns:
            An object of class Dataset populated with data.