コード例 #1
0
ファイル: grid.py プロジェクト: nomadcube/customized_weibo
 def __init__(self, *args, **kwargs):
     od = OrdDict()
     for item in args:
         od[None] = conversion.py2ro(item)
     for k, v in kwargs.items():
         od[k] = conversion.py2ro(v)
     res = self._constructor.rcall(tuple(od.items()), robjects.globalenv)
     self.__sexp__ = res.__sexp__
コード例 #2
0
def create_dataframe(columns):
    """
    Create a data frame from [(name, values), ..] columns (e.g. from a dict.iteritems())
    """
    result = OrdDict()
    for name, values in columns:
        result[name] = to_r(values)
    return robjects.DataFrame(result)
コード例 #3
0
 def _comparisons_dataframe(self):
     # col = ('Label.1', 'Label.2', 'win1', 'win2')
     # data = zip(col, [*self.comparison_items, *self.comparison_wins])
     # return DataFrame(OrdDict([data]))
     column_comp1 = ('Label.1',
                     FactorVector(self.comparison_items[0],
                                  levels=StrVector(self.items)))
     column_comp2 = ('Label.2',
                     FactorVector(self.comparison_items[1],
                                  levels=StrVector(self.items)))
     column_win1 = ('win1', FloatVector(self.comparison_wins[0]))
     column_win2 = ('win2', FloatVector(self.comparison_wins[1]))
     return DataFrame(
         OrdDict([column_comp1, column_comp2, column_win1, column_win2]))