Skip to content

Commit 0f78c9f

Browse files
committed
Revert "removed updation of dtype dict from c parser"
This reverts commit f0f3022.
1 parent 52c9bd5 commit 0f78c9f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/_libs/parsers.pyx

+8
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ from pandas.core.dtypes.common import (
108108
is_object_dtype,
109109
)
110110
from pandas.core.dtypes.dtypes import CategoricalDtype
111+
from pandas.core.dtypes.inference import is_dict_like
111112

112113
cdef:
113114
float64_t INF = <float64_t>np.inf
@@ -687,6 +688,13 @@ cdef class TextReader:
687688
counts[name] = count + 1
688689
name = f'{name}.{count}'
689690
count = counts.get(name, 0)
691+
if (
692+
self.dtype is not None
693+
and is_dict_like(self.dtype)
694+
and self.dtype.get(old_name) is not None
695+
and self.dtype.get(name) is None
696+
):
697+
self.dtype.update({name: self.dtype.get(old_name)})
690698

691699
if old_name == '':
692700
unnamed_cols.add(name)

0 commit comments

Comments
 (0)