windng
Check-in [b2ced12a2a]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Adapt to changes in DataFrame.to_string() (pandas 0.18.0)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b2ced12a2a945ec8ccb908b62cfd0f78b4a2d563
User & Date: goyo 2016-03-14 22:36:24
Context
2016-03-14
22:43
More alignmen issues with pandas 0.18.0 Leaf check-in: ee7d8236af user: goyo tags: trunk
22:36
Adapt to changes in DataFrame.to_string() (pandas 0.18.0) check-in: b2ced12a2a user: goyo tags: trunk
21:10
Changed behavior in dateutil.parser.parse(), read_wind() follows. check-in: 94f1126e27 user: goyo tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/test_io.py.

711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
        df = pd.DataFrame(data=data, index=index, columns=columns)

        buf = StringIO()
        wio.write_wind(df, buf)
        buf.seek(0)
        expected = (
"""       date      time  speed  gust   dir  std_dir  std_speed
 2010-07-30  00:00:00   4.24  4.78  11.2     5.20       0.59
 2010-07-30  00:10:00   4.02  5.46  20.8    10.35       0.59
 2010-07-30  00:20:00   4.25  6.34  19.7     9.43       0.72
 2010-07-30  00:30:00   4.74  5.28  36.7     3.90       0.23
 2010-07-30  00:40:00   4.09  4.82  32.3     5.11       0.37""")
        self.assertEqual(buf.read(), expected)


class Test_write_eolo(unittest.TestCase):
    """Test function write_eolo."""
    def test_write_eolo(self):
        """Test function write_eolo."""







|
|
|
|
|







711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
        df = pd.DataFrame(data=data, index=index, columns=columns)

        buf = StringIO()
        wio.write_wind(df, buf)
        buf.seek(0)
        expected = (
"""       date      time  speed  gust   dir  std_dir  std_speed
2010-07-30  00:00:00   4.24  4.78  11.2     5.20       0.59
2010-07-30  00:10:00   4.02  5.46  20.8    10.35       0.59
2010-07-30  00:20:00   4.25  6.34  19.7     9.43       0.72
2010-07-30  00:30:00   4.74  5.28  36.7     3.90       0.23
2010-07-30  00:40:00   4.09  4.82  32.3     5.11       0.37""")
        self.assertEqual(buf.read(), expected)


class Test_write_eolo(unittest.TestCase):
    """Test function write_eolo."""
    def test_write_eolo(self):
        """Test function write_eolo."""

Changes to windng/io.py.

1
2
3
4
5
6
7
8
9
10
11
12
...
300
301
302
303
304
305
306


307
308
309
310
311
312
313
# -*- coding: utf-8 -*-
#
# io.py
#
# Copyright 2012-2015 Goyo <goyodiaz@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
................................................................................
    if hasattr(path_or_buf, 'write'):
        buf = path_or_buf
        close = False
    else:
        buf = _get_handle(path_or_buf, 'w',)
        close = True
    try:


        result = df.to_string(buf, **kwargs)
    finally:
        if close:
            buf.close()
    return result






|







 







>
>







1
2
3
4
5
6
7
8
9
10
11
12
...
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# -*- coding: utf-8 -*-
#
# io.py
#
# Copyright 2012-2016 Goyo <goyodiaz@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
................................................................................
    if hasattr(path_or_buf, 'write'):
        buf = path_or_buf
        close = False
    else:
        buf = _get_handle(path_or_buf, 'w',)
        close = True
    try:
        if pd.__version__ == '0.18.0':  # Fix alignment.
            buf.write('       ')
        result = df.to_string(buf, **kwargs)
    finally:
        if close:
            buf.close()
    return result