diff --git a/modules/base/pymod/table.py b/modules/base/pymod/table.py index 09e10f61ab374ad987bb210ab3fd485baaa55aeb..e8735c3e335621de537b92db592145dead319003 100644 --- a/modules/base/pymod/table.py +++ b/modules/base/pymod/table.py @@ -275,6 +275,19 @@ class Table(object): ''' return self.name + def RenameCol(self, old_name, new_name): + """ + Rename column *old_name* to *new_name*. + + :param old_name: Name of the old column + :param new_name: Name of the new column + :raises: :exc:`ValueError` when *old_name* is not a valid column + """ + if old_name==new_name: + return + self.AddCol(new_name, self.col_types[self.GetColIndex(old_name)], + self[old_name]) + self.RemoveCol(old_name) def _Coerce(self, value, ty): ''' Try to convert values (e.g. from :class:`str` type) to the specified type diff --git a/modules/doc/table.rst b/modules/doc/table.rst index 73bc6cc79add46dc349b51c7c5a2d4280675fe20..f3af1277017dc3d8a20639362e32174a673734c7 100644 --- a/modules/doc/table.rst +++ b/modules/doc/table.rst @@ -59,6 +59,7 @@ Functions You Might be Interested In :meth:`~ost.table.Table.AddRow` add a row to the table :meth:`~ost.table.Table.AddCol` add a column to the table :meth:`~ost.table.Table.RemoveCol` remove a column from the table +:meth:`~ost.table.Table.RenameCol` rename a column :meth:`~ost.table.Table.Extend` append a table to the end of another table :meth:`~ost.table.Merge` merge two tables together :meth:`~ost.table.Table.Sort` sort table by column @@ -94,6 +95,8 @@ Functions You Might be Interested In :meth:`~ost.table.Table.PlotHistogram` Plot data as histogram :meth:`~ost.table.Table.PlotROC` Plot receiver operating characteristics (ROC) :meth:`~ost.table.Table.PlotEnrichment` Plot enrichment +:meth:`~ost.table.Table.PlotHexbin` Hexagonal density plot +:meth:`~ost.table.Table.PlotBar` Bar plot ============================================= ============================================ @@ -106,4 +109,4 @@ The Table class :members: :undoc-members: SUPPORTED_TYPES -.. autofunction:: ost.table.Merge \ No newline at end of file +.. autofunction:: ost.table.Merge