File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -2759,11 +2759,15 @@ export default class DataFrame extends NDframe implements DataFrameInterface {
27592759 ) : DataFrame | void {
27602760 const { columns, inplace } = { inplace : false , ...options }
27612761
2762- if ( ! oldValue && typeof oldValue !== 'boolean' ) {
2762+ if ( typeof oldValue === 'number' && isNaN ( oldValue ) ) {
2763+ throw Error ( `Params Error: Param 'oldValue' does not support NaN. Use DataFrame.fillNa() instead.` ) ;
2764+ }
2765+
2766+ if ( ! oldValue && typeof oldValue !== 'boolean' && typeof oldValue !== 'number' && typeof oldValue !== 'string' ) {
27632767 throw Error ( `Params Error: Must specify param 'oldValue' to replace` ) ;
27642768 }
27652769
2766- if ( ! newValue && typeof newValue !== 'boolean' ) {
2770+ if ( ! newValue && typeof newValue !== 'boolean' && typeof newValue !== 'number' && typeof newValue !== 'string' ) {
27672771 throw Error ( `Params Error: Must specify param 'newValue' to replace with` ) ;
27682772 }
27692773
Original file line number Diff line number Diff line change @@ -1536,11 +1536,15 @@ export default class Series extends NDframe implements SeriesInterface {
15361536 ) : Series | void {
15371537 const { inplace } = { inplace : false , ...options }
15381538
1539- if ( ! oldValue && typeof oldValue !== 'boolean' ) {
1539+ if ( typeof oldValue === 'number' && isNaN ( oldValue ) ) {
1540+ throw Error ( `Params Error: Param 'oldValue' does not support NaN. Use Series.fillNa() instead.` ) ;
1541+ }
1542+
1543+ if ( ! oldValue && typeof oldValue !== 'boolean' && typeof oldValue !== 'number' && typeof oldValue !== 'string' ) {
15401544 throw Error ( `Params Error: Must specify param 'oldValue' to replace` ) ;
15411545 }
15421546
1543- if ( ! newValue && typeof newValue !== 'boolean' ) {
1547+ if ( ! newValue && typeof newValue !== 'boolean' && typeof newValue !== 'number' && typeof newValue !== 'string' ) {
15441548 throw Error ( `Params Error: Must specify param 'newValue' to replace with` ) ;
15451549 }
15461550
You can’t perform that action at this time.
0 commit comments