A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
| <!-- Ignore the standard Argus form --> | |
| <ag-dashboard style="display:none"> | |
| </ag-dashboard> | |
| <!-- Google Charts loader for Argus, depends on jQuery --> | |
| <div> | |
| <h4>Debug output</h4> | |
| <div id="debugDiv"> | |
| </div> | |
| </div> |
| // class for any valid Argus metric expression | |
| function ArgusData(urlBase, validMetricExploreExpression){ | |
| this.base = urlBase + "/argusws/metrics?expression=", | |
| this.expression = validMetricExploreExpression, | |
| this.url = this.base + this.expression, | |
| this.queryArgus.bind(this), // IIFE to initalize this.dataTable | |
| this.pivotView = function(precision, groupColNum, filterValue, valueColNum){ | |
| // helper | |
| function round(value, decimals) { | |
| return Number(Math.round(value+'e'+decimals)+'e-'+decimals); |
| // helper to round values without rounding errors | |
| function round(value, decimals) { | |
| return Number(Math.round(value+'e'+decimals)+'e-'+decimals); | |
| } |
| <apex:page showHeader="true" controller="invoiceController" tabstyle="Invoice__c" sidebar="false"> | |
| <apex:includeScript value="{!$Resource.cometd}"/> | |
| <apex:includeScript value="{!$Resource.jquery}"/> | |
| <apex:includeScript value="{!$Resource.json2}"/> | |
| <apex:includeScript value="{!$Resource.jquery_cometd}"/> | |
| <script type="text/javascript"> | |
| (function($){ | |
| $(document).ready(function() { | |
| $.cometd.init({ | |
| url: window.location.protocol+'//'+window.location.hostname+'/cometd/24.0/', |
| Merchandise__c[] ml = new List<Merchandise__c>(); | |
| Merchandise__c m = new Merchandise__c( | |
| Name='Pencils', | |
| Description__c='Cool pencils', | |
| Price__c=1.5, | |
| Total_Inventory__c=1000); | |
| ml.add(m); | |
| Merchandise__c m2 = new Merchandise__c( | |
| Name='Notebooks', | |
| Description__c='Blue notebooks', |
| global class MortgageCalculator implements Process.Plugin | |
| { | |
| global Process.PluginResult invoke(Process.PluginRequest request) | |
| { | |
| Double amount = (Double)request.inputParameters.get('Amount'); | |
| Double term = (Double)request.inputParameters.get('Term'); | |
| // Magic here | |
| Double cMonthlyPayment; | |
| cMonthlyPayment=2750; | |
| Map<String, Object> result = new Map<String, Object>(); |
| @isTest | |
| private class TestDeleteRestrictAlbums { | |
| // Random number generator | |
| static double getRandomNumber() { | |
| return Math.random(); | |
| } | |
| // Album generator, with or without a track | |
| static Album__c createNewAlbum(Boolean withTrack) { | |
| // Create test album and insert it into the database |
| trigger DeleteRestrictAlbums on Album__c (before delete) { | |
| // With each of the albums targeted by the trigger that have tracks, | |
| // add an error to prevent them from being deleted. | |
| for (Album__c targetAlbum : [SELECT Id | |
| FROM Album__c | |
| WHERE Id IN (SELECT Album__c FROM Track__c) AND | |
| Id IN :Trigger.old]){ | |
| Trigger.oldMap.get(targetAlbum.id).addError( | |
| 'Cannot delete album with tracks'); |