Question: Here's the Code to pass and get image through intent,

secondActivity
--------------

```
                Intent intent = new Intent(this, PostVideoTagLocation.class);
                Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.index);
                ByteArrayOutputStream stream = new ByteArrayOutputStream();
                bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
                byte[] byteArray = stream.toByteArray();
                Intent intent2 = new Intent();
                intent2.putExtra("picture", byteArray);
                startActivityForResult(intent,1);
                setResult(RESULT_OK, intent2);

```

firstActivity
-------------

```
          if (requestCode == 1) {
            if(resultCode == RESULT_OK){
                Bundle extras = getIntent().getExtras();
                byte[] byteArray = extras.getByteArray("picture");
                Bitmap bmp = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
                ImageView image = (ImageView) findViewById(R.id.add_photo);
                image.setImageBitmap(bmp);
              }
           }

```

Answer: 
I think you need:

```
#if output is Series, convert it to DataFrame
df = df.rename('a').to_frame()

df['per'] = (df.a * 100 / df.a.sum()).round(1).astype(str) + '%'

print (df)
         a    per
1  1349110  31.7%
2  1606640  37.8%
3   175629   4.1%
4   790062  18.6%
5   330978   7.8%

```

**Timings**:

It seems faster is use `sum` as twice `value_counts`:

```
In [184]: %timeit (jez(s))
10 loops, best of 3: 38.9 ms per loop

In [185]: %timeit (pir(s))
10 loops, best of 3: 76 ms per loop

```

Code for timings:

```
np.random.seed([3,1415])
s = pd.Series(np.random.choice(list('ABCDEFGHIJ'), 1000, p=np.arange(1, 11) / 55.))
s = pd.concat([s]*1000)#.reset_index(drop=True)

def jez(s):
    df = s.value_counts()
    df = df.rename('a').to_frame()
    df['per'] = (df.a * 100 / df.a.sum()).round(1).astype(str) + '%'
    return df

def pir(s):
    return pd.DataFrame({'a':s.value_counts(), 
                         'per':s.value_counts(normalize=True).mul(100).round(1).astype(str) + '%'})

print (jez(s))
print (pir(s))

```
Here's a more pythonic snippet than what is proposed above I think

```py
def aspercent(column,decimals=2):
    assert decimals >= 0
    return (round(column*100,decimals).astype(str) + "%")

aspercent(df['mark'].value_counts(normalize=True),decimals=1)

```

This will output:

```
1   1349110 31.7%
2   1606640 37.8%
3   175629  4.1%
4   790062  18.6%
5   330978  7.8%

```

This also allows to adjust the number of decimals