Pandas: concatenate dataframes
<p>I have 2 dataframe</p>

<pre><code>category    count_sec_target
 3D-ÑÑÑÐµÑÑ  0.09375
 CÐµÑÐ¸Ð°Ð»Ñ    201.90625
 GPS Ð¸ ÐÐÐÐÐÐ¡Ð¡  0.015625
 Hi-Tech    187.1484375
 ÐÐ±Ð¸ÑÑÑÐ¸ÐµÐ½ÑÐ°Ð¼   0.8125
 ÐÐ²Ð¸Ð°ÐºÐ¾Ð¼Ð¿Ð°Ð½Ð¸Ð¸   8.40625
</code></pre>

<p>and </p>

<pre><code>category    count_sec_random
 3D-ÑÑÑÐµÑÑ  0.369565217
 Hi-Tech    70.42391304
 ÐÐ¡Ð£ Ð¢Ð,  Ð¿ÑÐ¾Ð¼ÑÐ»ÐµÐºÑÑÐ¾Ð½Ð¸ÐºÐ°   0.934782609
 ÐÐ±Ð¸ÑÑÑÐ¸ÐµÐ½ÑÐ°Ð¼   1.413043478
 ÐÐ²Ð¸Ð°ÐºÐ¾Ð¼Ð¿Ð°Ð½Ð¸Ð¸   14.93478261
 ÐÐ²ÑÐ¾   480.3369565
</code></pre>

<p>I need to concatenate that And get </p>

<pre><code>category    count_sec_target    count_sec_random
 3D-ÑÑÑÐµÑÑ  0.09375    0.369565217
 CÐµÑÐ¸Ð°Ð»Ñ    201.90625   0
 GPS Ð¸ ÐÐÐÐÐÐ¡Ð¡  0.015625   0
 Hi-Tech    187.1484375   70.42391304
 ÐÐ±Ð¸ÑÑÑÐ¸ÐµÐ½ÑÐ°Ð¼   0.8125   1.413043478
 ÐÐ²Ð¸Ð°ÐºÐ¾Ð¼Ð¿Ð°Ð½Ð¸Ð¸   8.40625   14.93478261
 ÐÐ¡Ð£ Ð¢Ð,  Ð¿ÑÐ¾Ð¼ÑÐ»ÐµÐºÑÑÐ¾Ð½Ð¸ÐºÐ°   0    0.934782609
 ÐÐ²ÑÐ¾   0     480.3369565
</code></pre>

<p>And next I want to divide values in col <code>(count_sec_target / count_sec_random) * 100%</code>
But when I try to concatenate df</p>

<pre><code>frames = [df1, df1]
df = pd.concat(frames)
I get 
category  count_sec_random  count_sec_target
 0                        3D-ÑÑÑÐµÑÑ          0.369565               NaN
 1                          Hi-Tech         70.423913               NaN
 2         ÐÐ¡Ð£ Ð¢Ð,  Ð¿ÑÐ¾Ð¼ÑÐ»ÐµÐºÑÑÐ¾Ð½Ð¸ÐºÐ°          0.934783               NaN
 3                     ÐÐ±Ð¸ÑÑÑÐ¸ÐµÐ½ÑÐ°Ð¼          1.413043               NaN
 4                     ÐÐ²Ð¸Ð°ÐºÐ¾Ð¼Ð¿Ð°Ð½Ð¸Ð¸         14.934783               NaN
</code></pre>

<p>Also I try <code>df = df1.append(df2)</code>
BUt I get wrong result.
How can I fix that? </p>

<p>Merge should be appropriate here:</p>

<pre><code>df_1.merge(df_2, on='category', how='outer').fillna(0)
</code></pre>

<p><a href="http://i.stack.imgur.com/4pk3L.png" rel="nofollow"><img src="http://i.stack.imgur.com/4pk3L.png" alt="Image"></a></p>

<hr>

<p>To get the division output, simply do:</p>

<pre><code>df['division'] = df['count_sec_target'].div(df['count_sec_random'])  * 100
</code></pre>

<p>where: <code>df</code> is the merged DF</p>

python pandas