Skip to content

Commit

Permalink
tSQLike-1.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
mezantrop committed Sep 24, 2024
1 parent 82add0e commit 8324847
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# CHANGELOG

* **2024.09.24 Current - tSQLike-1.1.5 (candidate)**
* **2024.09.24 tSQLike-1.1.5**
* `column_map()` respects `use_shortnames`; handles a case with no `function` argument
* `group_by()` respects `use_shortnames`; `group_by()` to handle case with no `ftarget` or `function` arguments
* `order_by()` respects `use_shortnames`
* `join_lt()` respects `use_shortnames` for both Tables
Expand Down
15 changes: 12 additions & 3 deletions tsqlike/tsqlike.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,8 @@ def group_by(self, column='', function=None, ftarget=None, new_tname='', **kwarg
"""

if not ftarget or not function:
return Table(self)
return Table(name=new_tname if new_tname else
self.name + TNAME_TNAME_DELIMITER + str(self.timestamp), data=self.table)

header = self.header
if kwargs.get('use_shortnames', self.use_shortnames):
Expand All @@ -875,16 +876,24 @@ def group_by(self, column='', function=None, ftarget=None, new_tname='', **kwarg
data=[[column, ftarget]] + [[k, v] for k, v in gd.items()])

# -------------------------------------------------------------------------------------------- #
def column_map(self, column='', function=None, new_tname=''):
def column_map(self, column='', function=None, new_tname='', **kwargs):

"""
Apply a function to a column
"""

if not function:
return Table(name=new_tname if new_tname else
self.name + TNAME_TNAME_DELIMITER + str(self.timestamp), data=self.table)

header = self.header
if kwargs.get('use_shortnames', self.use_shortnames):
header = self.make_shortnames()

try:
col = -1
if column != '*':
col = self.header.index(column)
col = header.index(column)
except ValueError:
return Table()

Expand Down

0 comments on commit 8324847

Please sign in to comment.