Removing square brackets in pandas python for exporting to csv
<p>I have a dataset which prints like the following. I'm trying to export this dataset to CSV and I would like to remove the square brackets on the dataframe. I've tried the solution in this <a href="http://stackoverflow.com/questions/38147447/how-to-remove-square-bracket-from-pandas-dataframe">question</a> unsuccessfully. Any suggestion is appreciated.</p>

<pre><code>                                                  A  \
2016-09-12 19:00:00,  [143.328125, 35, 143.359375, 15]
2016-09-12 20:00:00,    [143.4375, 22, 143.453125, 23]
2016-09-12 21:00:00,       [143.484375, 17, 143.5, 22]
2016-09-12 22:00:00,     [143.546875, 91, 143.5625, 1]
2016-09-12 23:00:00,        [143.5, 3, 143.515625, 21]
2016-09-13 00:00:00,    [143.46875, 27, 143.484375, 9]
2016-09-13 01:00:00,    [143.421875, 12, 143.4375, 78]
2016-09-13 02:00:00,    [143.3125, 34, 143.328125, 13]
2016-09-13 03:00:00,    [143.34375, 5, 143.359375, 79]
2016-09-13 04:00:00,     [143.4375, 5, 143.453125, 64]
2016-09-13 05:00:00,    [143.515625, 62, 143.53125, 8]
2016-09-13 06:00:00,  [143.40625, 115, 143.421875, 15]
2016-09-13 07:00:00,   [143.328125, 53, 143.34375, 24]
2016-09-13 08:00:00,   [143.328125, 51, 143.34375, 65]
2016-09-13 09:00:00,  [143.203125, 73, 143.21875, 167]
2016-09-13 10:00:00,   [143.171875, 129, 143.1875, 63]
2016-09-13 11:00:00,    [142.671875, 59, 142.6875, 83]
2016-09-13 12:00:00,       [142.5, 16, 142.515625, 64]
2016-09-13 13:00:00,  [142.4375, 117, 142.453125, 111]
2016-09-13 14:00:00,  [142.40625, 130, 142.421875, 47]
2016-09-13 15:00:00,   [142.578125, 60, 142.59375, 79]
2016-09-13 16:00:00,         [142.46875, 1, 142.5, 84]

                                                 B   \
2016-09-12 19:00:00,        [166.9375, 61, 167.0, 80]
2016-09-12 20:00:00,     [167.125, 62, 167.15625, 42]
2016-09-12 21:00:00,      [167.21875, 20, 167.25, 51]
2016-09-12 22:00:00,    [167.28125, 49, 167.3125, 42]
2016-09-12 23:00:00,      [167.25, 45, 167.28125, 43]
2016-09-13 00:00:00,    [167.1875, 69, 167.21875, 33]
2016-09-13 01:00:00,     [167.125, 42, 167.15625, 34]
2016-09-13 02:00:00,      [166.96875, 105, 167.0, 23]
2016-09-13 03:00:00,    [167.09375, 49, 167.125, 137]
2016-09-13 04:00:00,    [167.375, 47, 167.40625, 123]
2016-09-13 05:00:00,   [167.53125, 71, 167.5625, 185]
2016-09-13 06:00:00,  [167.28125, 128, 167.3125, 104]
2016-09-13 07:00:00,   [167.09375, 124, 167.125, 155]
2016-09-13 08:00:00,   [167.125, 175, 167.15625, 172]
2016-09-13 09:00:00,   [166.78125, 218, 166.8125, 27]
2016-09-13 10:00:00,  [166.65625, 100, 166.6875, 117]
2016-09-13 11:00:00,    [165.625, 381, 165.65625, 84]
2016-09-13 12:00:00,    [165.40625, 47, 165.4375, 34]
2016-09-13 13:00:00,     [165.21875, 161, 165.25, 95]
2016-09-13 14:00:00,  [165.28125, 318, 165.3125, 388]
2016-09-13 15:00:00,   [165.4375, 208, 165.46875, 93]
2016-09-13 16:00:00,      [165.21875, 16, 165.25, 42]

                                                     C
2016-09-12 19:00:00,     [130.578125, 96, 130.59375, 541]
2016-09-12 20:00:00,   [130.640625, 493, 130.65625, 1146]
2016-09-12 21:00:00,    [130.65625, 828, 130.671875, 115]
2016-09-12 22:00:00,    [130.71875, 599, 130.734375, 417]
2016-09-12 23:00:00,    [130.65625, 678, 130.671875, 409]
2016-09-13 00:00:00,    [130.640625, 940, 130.65625, 656]
2016-09-13 01:00:00,     [130.59375, 615, 130.609375, 59]
2016-09-13 02:00:00,    [130.53125, 553, 130.546875, 292]
2016-09-13 03:00:00,   [130.53125, 1028, 130.546875, 224]
2016-09-13 04:00:00,   [130.59375, 1122, 130.609375, 320]
2016-09-13 05:00:00,    [130.65625, 890, 130.671875, 600]
2016-09-13 06:00:00,    [130.578125, 1166, 130.59375, 94]
2016-09-13 07:00:00,    [130.546875, 330, 130.5625, 1169]
2016-09-13 08:00:00,   [130.53125, 1109, 130.546875, 731]
2016-09-13 09:00:00,    [130.453125, 987, 130.46875, 952]
2016-09-13 10:00:00,   [130.46875, 220, 130.484375, 1780]
2016-09-13 11:00:00,    [130.125, 1010, 130.140625, 1227]
2016-09-13 12:00:00,    [130.015625, 139, 130.03125, 100]
2016-09-13 13:00:00,       [129.984375, 1227, 130.0, 411]
2016-09-13 14:00:00,  [129.96875, 1628, 129.984375, 1676]
2016-09-13 15:00:00,   [130.09375, 1712, 130.109375, 408]
2016-09-13 16:00:00,    [130.015625, 328, 130.03125, 205]
</code></pre>

<p>I am new to <code>pandas</code>. There may be a better way but this what I could manage:</p>

<pre><code>for col in df:
    df[col] = df[col].str.extract(r'\[(.*)\]')
</code></pre>

python csv