0

I came across with this "frozenset({' ABC'})" in pandas dataframe but I would like to change it from object type back to frozenset type , for example like this frozenset({' ABC'}) in the row.

  • 1
    Please provide a short code example, it seems likely that this is a classic mistake of confusing the representation of a value with the actual value. – Grismar Nov 16 '21 at 07:22
  • 2
    Perhaps `ast.literal_eval()`, although it sounds like an XY problem. – j1-lee Nov 16 '21 at 07:23
  • 1
    Why do you have that in your dataframe in the first place? It sounds like this is a problem that should be fixed by fixing the code that creates the problem, rather than trying to post-process the result. – user2357112 Nov 16 '21 at 07:25
  • *"change it from object type back to frozenset type"* -- Pandas doesn't have a `frozenset` type... It'd go under `object`. – wjandrea Nov 16 '21 at 07:28
  • BTW, welcome to Stack Overflow! Check out the [tour], and [ask] if you want tips. For reference on what j1's saying: [XY problem](https://meta.stackexchange.com/q/66377/343832) – wjandrea Nov 16 '21 at 07:29
  • Please provide enough code so others can better understand or reproduce the problem. – Community Nov 17 '21 at 17:16

0 Answers0