File tree Expand file tree Collapse file tree 4 files changed +28
-6
lines changed Expand file tree Collapse file tree 4 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ pandas 0.8.2
76
76
- Hack to support storing data with a zero-length axis in HDFStore (#1707)
77
77
- Fix DatetimeIndex tz-aware range generation issue (#1674)
78
78
- Fix method='time' interpolation with intraday data (#1698)
79
+ - Don't plot all-NA DataFrame columns as zeros (#1696)
79
80
80
81
pandas 0.8.1
81
82
============
Original file line number Diff line number Diff line change @@ -606,6 +606,21 @@ def str_decode(arr, encoding):
606
606
f = lambda x : x .decode (encoding )
607
607
return _na_map (f , arr )
608
608
609
+ def str_encode (arr , encoding ):
610
+ """
611
+ Encode character string to unicode using indicated encoding
612
+
613
+ Parameters
614
+ ----------
615
+ encoding : string
616
+
617
+ Returns
618
+ -------
619
+ encoded : array
620
+ """
621
+ f = lambda x : x .encode (encoding )
622
+ return _na_map (f , arr )
623
+
609
624
def _noarg_wrapper (f ):
610
625
def wrapper (self ):
611
626
result = f (self .series )
@@ -728,6 +743,11 @@ def decode(self, encoding):
728
743
result = str_decode (self .series , encoding )
729
744
return self ._wrap_result (result )
730
745
746
+ @copy (str_encode )
747
+ def encode (self , encoding ):
748
+ result = str_encode (self .series , encoding )
749
+ return self ._wrap_result (result )
750
+
731
751
count = _pat_wrapper (str_count , flags = True )
732
752
startswith = _pat_wrapper (str_startswith )
733
753
endswith = _pat_wrapper (str_endswith )
Original file line number Diff line number Diff line change @@ -658,8 +658,9 @@ def test_match_findall_flags(self):
658
658
result = data .str .contains (pat , flags = re .IGNORECASE )
659
659
self .assertEquals (result [0 ], True )
660
660
661
- def test_decode (self ):
662
- series = Series (['a' , 'b' , '\xc3 \xa4 ' ])
661
+ def test_encode_decode (self ):
662
+ base = Series ([u'a' , u'b' , u'\xe4 ' ])
663
+ series = base .str .encode ('utf-8' )
663
664
664
665
f = lambda x : x .decode ('utf-8' )
665
666
result = series .str .decode ('utf-8' )
Original file line number Diff line number Diff line change @@ -551,11 +551,11 @@ def _iter_data(self):
551
551
columns = df .columns
552
552
553
553
for col in columns :
554
- empty = df [col ].count () == 0
555
- # is this right?
556
- values = df [col ].values if not empty else np .zeros (len (df ))
557
-
554
+ # # is this right?
555
+ # empty = df[col].count() == 0
556
+ # values = df[col].values if not empty else np.zeros(len(df))
558
557
558
+ values = df [col ].values
559
559
yield col , values
560
560
561
561
@property
You can’t perform that action at this time.
0 commit comments