def input_pandas_to_okapi(self, data):
        data = data[:]
        # If data don't have ratings than the rating column is created with 1.
        if "rating" not in data:
            data["rating"] = [1. for _ in xrange(len(data))]


        # Make a generator with lines for okapi file format
        okapi_rows = []
        items = set([])
        for _, row in data.iterrows():
            okapi_rows.append("%(user)s %(item)s %(rating)s" % {  # okapi line
                "user": row["user"],
                "item": row["item"],
                "rating": row["rating"]
            })
            items.add(row["item"])
        self._max_item_id = len(items)
        return "\n".join(okapi_rows)
Return a string with the data in the pandas DataFrame in okapi format
dataset/ETHPy150Open grafos-ml/test.fm/src/testfm/okapi/connector.py/DynamicOkapiModel.input_pandas_to_okapi