Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In static console, 'c3Grid' displays the 'evaluate' method's result nicely: Note: the 'locationType' expression within the 'group' field is also within the 'projection' field. This is required.

Code Block
languagejs
var eval_result = OutbreakLocation.evaluate({
    'projection': 'avg(countryArea), locationType',
    'group': 'locationType',
    'filter': 'exists(countryArea) && exists(locationType)'
})
c3Grid(eval_result)

...

Users can also run the 'evaluate' method in python. In this case, users often modify the 'evaluate' method's results for data analysis. To view and analyze the 'evaluate' method's results in Python, please use the helper function available in DTI's c3python module here: https://github.com/c3aidti/c3python NOTE: the 'locationType' expression within the 'group' field is also within the 'projection' field. This is required.

Code Block
languagepy
eval_spec = {
    'projection': 'avg(countryArea), locationType',
    'group': 'locationType',
    'filter': 'exists(countryArea) && exists(locationType)'
}
eval_res = c3.OutbreakLocation.evaluate(eval_spec)
df = c3python.EvaluateResultToPandas(result=eval_res, eval_spec=eval_spec)

...

Here's another example of running the 'evaluate' method in Python, this time using the 'order' parameter as well: NOTE: the 'count(ethnicity)' expression within the 'order' field is also within the 'projection' field. This is required.

Code Block
languagepy
spec = c3.EvaluateSpec(
    projection="ethnicity, count(ethnicity)",
    order='descending(count(ethnicity))',
    group="ethnicity"
)
c3python.EvaluateResultToPandas(result=c3.SurveyData.evaluate(spec), eval_spec=spec)

Image Added

 Image Removed


To learn more about the 'evaluate' method, please see the C3.ai resources here:

...