Reads data from URL, Dataframe, JSON string, JSON file
           or OrderedDict.
        Args:
            data: can be a Pandas Dataframe, a JSON string, a JSON file,
                  an OrderedDict or a URL pointing to a JSONstat file.

        Returns:
            An object of class Dimension populated with data.

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

        Returns:
            An object of class Dimension populated with data.

        """
        if isinstance(data, pd.DataFrame):
            output = OrderedDict({})
            output['version'] = '2.0'
            output['class'] = 'dimension'
            [label] = [x for x in list(data.columns.values) if
                       x not in ['id', 'index']]
            output['label'] = label
            output['category'] = OrderedDict({})
            output['category']['index'] = data.id.tolist()
            output['category']['label'] = OrderedDict(
                zip(data.id.values, data[label].values))
            return cls(output)
        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