npx babel index.js从命令行运行时,我希望能看到从 babel.config.js 应用我的 babel 配置
但事实似乎并非如此,因为我想知道为什么会这样?
// babel.config.js
module.exports = function babel(api) {
api.cache(true);
return {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
'babel-plugin-root-import',
{
rootPathSuffix: './src',
rootPathPrefix: '~/',
},
],
],
};
};
// index.js
import { AppRegistry } from 'react-native';
import App from '~/App';
AppRegistry.registerComponent("App Name", () => App)
// Expected output from npx babel index.js
import { AppRegistry } from 'react-native';
import App from './src/App'; // Note the change from '~' to './src' using babel-plugin-root-import
AppRegistry.registerComponent("App …Run Code Online (Sandbox Code Playgroud) 我正在使用一个数据集,其中不存在的值显示为负数。我想将这些值转换为 np.nan 值,但我不知道如何转换。这样做的条件是(array < 0)。
数组会发生什么的一个例子是:
import numpy as np
array = np.array([[-1, 1, -1, 1],
[ 1, -1, -1, 1],
[ 1, -1, -1, -1]])
Run Code Online (Sandbox Code Playgroud)
然后转换为:
np.array([[np.nan, 1, np.nan, 1],
[ 1, np.nan, np.nan, 1],
[ 1, np.nan, np.nan, np.nan]])
Run Code Online (Sandbox Code Playgroud)
干杯
arrays ×1
babel-cli ×1
babeljs ×1
javascript ×1
npx ×1
numpy ×1
python ×1
python-3.x ×1
react-native ×1