scale

Apply StandardScaler to parts of a data set

橙三吉。 提交于 2020-12-28 06:53:07
问题 I want to use sklearn 's StandardScaler . Is it possible to apply it to some feature columns but not others? For instance, say my data is: data = pd.DataFrame({'Name' : [3, 4,6], 'Age' : [18, 92,98], 'Weight' : [68, 59,49]}) Age Name Weight 0 18 3 68 1 92 4 59 2 98 6 49 col_names = ['Name', 'Age', 'Weight'] features = data[col_names] I fit and transform the data scaler = StandardScaler().fit(features.values) features = scaler.transform(features.values) scaled_features = pd.DataFrame(features,

Android scale button on touch

天涯浪子 提交于 2020-11-28 07:47:12
问题 I know how to scale the button to a determinated value, but is there a way to increase/decrease the button size per time as long the user is touching it? Something like this: Button myButton = (Button)findViewById(R.id.myButton); myButton.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { // Some timer action here or is there a better way? v.setScaleX(v.getScaleX() + 0.1f); v

Square root scale using matplotlib/python

血红的双手。 提交于 2020-11-25 02:39:17
问题 I want to make a plot with square root scale using Python: However, I have no idea how to make it. Matplotlib allows to make log scale but in this case I need something like power function scale. 回答1: You can make your own ScaleBase class to do this. I have modified the example from here (which made a square-scale, not a square-root-scale) for your purposes. Also, see the documentation here. Note that to do this properly, you should probably also create your own custom tick locator; I haven't