Skip to content

QST: Does the following method have circular dependencies? hash_pandas_object #35097

@alessiosavi

Description

@alessiosavi
  • I have searched the [pandas] tag on StackOverflow for similar questions.

  • I have asked my usage related question on StackOverflow.


Question about pandas

Hi Team, does the method hash_pandas_object have circular dependencies?

I'm not able to serialize class that contains the method in my code with dill.

# Your code here, if applicable
import numpy as np
import pandas as pd
from pandas.core.util.hashing import hash_pandas_object
# Same result using the following library
# from pandas.util import hash_pandas_object


class T:
	def __init__(self):
		self.dataset_hash = ""

	def main(self):
		df = pd.DataFrame(np.random.randint(0, 100, size=(100, 4)), columns=list('ABCD'))
		print(df)
		self.dataset_hash = hash_pandas_object(df).sum()


import sys
import dill

sys.setrecursionlimit(10 ** 4)

t = T()
with open("test.dill", "wb") as f:
	dill.dump(t, f, recurse=True)
t.main()

NOTE:
I've opened an issue to the dill repository to [https://github.com/uqfoundation/dill/issues/374]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions