How to create a DataFrame of random integers with Pandas?

numpy.random.randint accepts a third argument (size) , in which you can specify the size of the output array. You can use this to create your DataFrame – df = pd.DataFrame(np.random.randint(0,100,size=(100, 4)), columns=list(‘ABCD’)) Here – np.random.randint(0,100,size=(100, 4)) – creates an output array of size (100,4) with random integer elements between [0,100) . Demo – import numpy … Read more

Multi-gradient shapes

I don’t think you can do this in XML (at least not in Android), but I’ve found a good solution posted here that looks like it’d be a great help! ShapeDrawable.ShaderFactory sf = new ShapeDrawable.ShaderFactory() { @Override public Shader resize(int width, int height) { LinearGradient lg = new LinearGradient(0, 0, width, height, new int[]{Color.GREEN, Color.GREEN, … Read more

Set android shape color programmatically

Note: Answer has been updated to cover the scenario where background is an instance of ColorDrawable. Thanks Tyler Pfaff, for pointing this out. The drawable is an oval and is the background of an ImageView Get the Drawable from imageView using getBackground(): Drawable background = imageView.getBackground(); Check against usual suspects: if (background instanceof ShapeDrawable) { … Read more

Rounded corner for textview in android

Create rounded_corner.xml in the drawable folder and add the following content, <?xml version=”1.0″ encoding=”utf-8″?> <shape xmlns:android=”http://schemas.android.com/apk/res/android” > <stroke android:width=”1dp” android:color=”@color/common_border_color” /> <solid android:color=”#ffffff” /> <padding android:left=”1dp” android:right=”1dp” android:bottom=”1dp” android:top=”1dp” /> <corners android:radius=”5dp” /> </shape> Set this drawable in the TextView background property like so: android:background=”@drawable/rounded_corner” I hope this is useful for you.

How to make gradient background in android

Visual examples help with this kind of question. Boilerplate In order to create a gradient, you create an xml file in res/drawable. I am calling mine my_gradient_drawable.xml: <?xml version=”1.0″ encoding=”utf-8″?> <shape xmlns:android=”http://schemas.android.com/apk/res/android”> <gradient android:type=”linear” android:angle=”0″ android:startColor=”#f6ee19″ android:endColor=”#115ede” /> </shape> You set it to the background of some view. For example: <View android:layout_width=”200dp” android:layout_height=”100dp” android:background=”@drawable/my_gradient_drawable”/> type=”linear” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)