I'm trying to use some functions from pydbgen module. Some of them work while the others keep getting me the following error:
import pydbgen
from pydbgen import pydbgen
myDB=pydbgen.pydb()
testdf=myDB.gen_dataframe(5,['name','city','phone','date'])
Traceback (most recent call last):
File "C:/Users/user/PycharmProjects/pythonProject1/BIrainSensor.py", line 5, in <module>
testdf=myDB.gen_dataframe(5,['name','city','phone','date'])
File "C:\Users\user\PycharmProjects\pythonProject1\venv\lib\site-packages\pydbgen\pydbgen.py", line 330, in gen_dataframe
df = pd.DataFrame(data=self.gen_data_series(num,data_type=fields[0]),columns=[fields[0]])
File "C:\Users\user\PycharmProjects\pythonProject1\venv\lib\site-packages\pydbgen\pydbgen.py", line 191, in gen_data_series
fake.seed(self.seed)
File "C:\Users\user\PycharmProjects\pythonProject1\venv\lib\site-packages\faker\proxy.py", line 83, in __getattribute__
raise TypeError(msg)
TypeError: Calling `.seed()` on instances is deprecated. Use the class method `Faker.seed()` instead.
I tried to google it but found nothing. I also tried to downgrade Faker to version 2.0.0 but it doesn't work
UPDATE: It seems that the code works fine in CMD prompt but it still doesn't work in Pycharm
Thanks in advance
Installing Faker 2.0.5 worked for me
pip install Faker==2.0.5
Example:
myDB = pydbgen.pydb()
testdf = myDB.gen_dataframe(5,['name','city','phone','date'])
print(testdf)
Output:
name city phone-number date
0 Ronald Reyes South Oroville 631-367-2892 1984-04-14
1 Scott Nguyen Glenmoore 350-506-1497 1978-11-18
2 Joseph Rogers Cherry Tree 315-937-6733 2012-11-13
3 Alisha Whitehead Iola 870-884-0471 1998-02-04
4 Christopher Cook Liverpool 370-595-5729 2017-10-30