Skip to content

Commit 4e375e8

Browse files
committed
formatting issues and copy issues
git-svn-id: http://pandas.googlecode.com/svn/trunk@200 d5231056-7de3-11de-ac95-d976489f1ece
1 parent 219809a commit 4e375e8

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

pandas/core/common.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ def _unpickle_array(bytes):
6060
arr = read_array(StringIO(bytes))
6161
return arr
6262

63+
def _to_str(x):
64+
# str(x) fails when x contains unicode
65+
return '%s' % x
66+
6367
def _pfixed(s, space, nanRep=None, float_format=None):
6468
if isinstance(s, float):
6569
if nanRep is not None and isnull(s):
@@ -75,7 +79,7 @@ def _pfixed(s, space, nanRep=None, float_format=None):
7579

7680
return formatted.ljust(space)
7781
else:
78-
return str(s)[:space-4].ljust(space)
82+
return _to_str(s)[:space].ljust(space)
7983

8084

8185

pandas/core/frame.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,9 @@ def asfreq(self, freq, fillMethod=None):
681681
fillMethod : {'backfill', 'pad', None}
682682
Method to use for filling holes in new inde
683683
"""
684+
if len(self.index) == 0:
685+
return self.copy()
686+
684687
if isinstance(freq, datetools.DateOffset):
685688
dateRange = DateRange(self.index[0], self.index[-1], offset=freq)
686689
else:

pandas/stats/ols.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ def _combine_rhs(rhs):
11391139
if isinstance(rhs, Series):
11401140
series['x'] = rhs
11411141
elif isinstance(rhs, DataFrame):
1142-
series = rhs
1142+
series = rhs.copy()
11431143
elif isinstance(rhs, dict):
11441144
for name, value in rhs.iteritems():
11451145
if isinstance(value, Series):

0 commit comments

Comments
 (0)