File tree 1 file changed +13
-13
lines changed 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -896,20 +896,20 @@ def read(self) -> DataFrame | Series:
896
896
Read the whole JSON input into a pandas object.
897
897
"""
898
898
obj : DataFrame | Series
899
- if self .lines :
900
- if self .chunksize :
901
- obj = concat (self )
902
- elif self .nrows :
903
- lines = list (islice (self .data , self .nrows ))
904
- lines_json = self ._combine_lines (lines )
905
- obj = self ._get_object_parser (lines_json )
899
+ with self :
900
+ if self .lines :
901
+ if self .chunksize :
902
+ obj = concat (self )
903
+ elif self .nrows :
904
+ lines = list (islice (self .data , self .nrows ))
905
+ lines_json = self ._combine_lines (lines )
906
+ obj = self ._get_object_parser (lines_json )
907
+ else :
908
+ data = ensure_str (self .data )
909
+ data_lines = data .split ("\n " )
910
+ obj = self ._get_object_parser (self ._combine_lines (data_lines ))
906
911
else :
907
- data = ensure_str (self .data )
908
- data_lines = data .split ("\n " )
909
- obj = self ._get_object_parser (self ._combine_lines (data_lines ))
910
- else :
911
- obj = self ._get_object_parser (self .data )
912
- self .close ()
912
+ obj = self ._get_object_parser (self .data )
913
913
return obj
914
914
915
915
def _get_object_parser (self , json ) -> DataFrame | Series :
You can’t perform that action at this time.
0 commit comments