The Script data source allows you to add additional data into a report. Script data sources are able to reference data keys from other data sources. This allows you to modify keys from one data source, and return a new altered data source.
Example
Say we have a query data source named "Area Data" which contains four columns: month, north_area, south_area, and t_stamp. If we need to build a new data source without the t_stamp column we can use the following code:
#build a header and initialize a pydataset
header = ['month', 'north_area', 'south_area']
filteredDataset = []
#get the results from the Area Data data source
rawDataset = data['Area Data'].getCoreResults()
#build the new pydataset out of only some of the Area Data's data keys
for row in range(rawDataset.rowCount):
valCategory = rawDataset.getValueAt(row,'month')
valNorthArea = rawDataset.getValueAt(row,'north_area')
valSouthArea = rawDataset.getValueAt(row,'south_area')
filteredDataset.append([valCategory,valNorthArea,valSouthArea])
#convert the pydataset to a standard dataset
filteredDataset = system.dataset.toDataSet(header, filteredDataset)
#create a new data source with the filtered results
data['updated Area Data'] = filteredDataset

The above code would create a new data source in the Design panel named 'updated Area Data'. Note that .getCoreResults() is only applicable when the raw data source is a query. If 'Area Data' in the example above was a static CSV then you could get the data into a 'new data source' with the following:
data['new data source'] = data['Area Data']
What if our 'Area Data' query has a nested query called 'Area Details' that we would like to manipulate in a script?
nested = data['Area Data'].getNestedQueryResults() # Gets results from our parent query
subQuery = nested['Area Details'] #Gets the subquery we want -- there can be more than one
header = ['productName', 'cost', 'triple']
alteredDataset = []
for child in subQuery:
children = child.getCoreResults() # children is a dataset
for row in range(children.rowCount):
valProductName = children.getValueAt(row,'productName')
valCost = children.getValueAt(row,'cost')
valTimesThree = None
if valCost != None:
valTimesThree = 3 * valCost
alteredDataset.append([valProductName,valCost,valTimesThree])
#convert the pydataset to a standard dataset
alteredDataset = system.dataset.toDataSet(header, alteredDataset)
#create a new data source with the altered results
data['Updated Area Details'] = alteredDataset