Exemple #1
0
 def __call__(self, accessor):
     setattr(Series, self.name, AccessorProperty(accessor, accessor))
     return accessor
Exemple #2
0
 def __call__(self, accessor):
     setattr(DataFrame, self.name, AccessorProperty(accessor, accessor))
     return accessor
Exemple #3
0
class RevolutionDataFrame(pd.DataFrame):
    @property
    def _constructor(self):
        return RevolutionDataFrame

    def compute_min_max_angles(self):
        # @TODO this method is quite memory inefficient. Row by row calculation is better
        torque_columns = torque_column_labels()
        torque_T = self.loc[:, torque_columns].transpose().reset_index(drop=True)

        left_max_angle = torque_T.iloc[:180].idxmax()
        right_max_angle = torque_T.iloc[180:].idxmax() - 180
        
        left_min_angle = pd.concat([torque_T.iloc[:135], torque_T.iloc[315:]]).idxmin()
        right_min_angle = torque_T.iloc[135:315].idxmin() - 180

        left_max = pd.DataFrame(left_max_angle)
        right_max = pd.DataFrame(right_max_angle)
        left_min = pd.DataFrame(left_min_angle)
        right_min = pd.DataFrame(right_min_angle)

        return left_max, right_max, left_min, right_min

    def _average_by_column(self, column_name):
        averaged_self = self.groupby(column_name).mean().reset_index()
        return RevolutionDataFrame(averaged_self)


RevolutionDataFrame.plot = AccessorProperty(RevolutionPlotMethods,
        RevolutionPlotMethods)
Exemple #4
0
 def _(cls):
     setattr(pd_cls, name, AccessorProperty(cls, cls))
     return cls
Exemple #5
0
 def __call__(self, accessor):
     setattr(DataFrameGroupBy, self.name,
             AccessorProperty(accessor, accessor))
Exemple #6
0
def monkeypatch_pandas():
    DataFrame.vgplot = AccessorProperty(FrameVgPlotMethods, FrameVgPlotMethods)
    Series.vgplot = AccessorProperty(SeriesVgPlotMethods, SeriesVgPlotMethods)