faker

Using Python Faker generate different data for 5000 rows

依然范特西╮ 提交于 2019-12-06 07:18:17
问题 I would like to use the Python Faker library to generate 500 lines of data, however I get repeated data using the code I came up with below. Can you please point out where I'm going wrong. I believe it has something to do with the for loop. Thanks in advance: from faker import Factory import pandas as pd import random def create_fake_stuff(fake): df = pd.DataFrame(columns=('name' , 'email' , 'bs' , 'address' , 'city' , 'state' , 'date_time' , 'paragraph' , 'Conrad' ,'randomdata')) stuff =

Laravel, Faker - Increment generated dateTime

别等时光非礼了梦想. 提交于 2019-12-04 15:02:10
I'm using Faker package in my Seeder to generate fake data for training events. Each event has starts_at and ends_at fields. I want to populate the ends_at field with a DateTime that is after the one generated for starts_at , preferably by 1 to 8 hours, or even a fixed 1 hour difference would be fine. here is an easy way to define the ends_at $starts_at = Carbon::createFromTimestamp($faker->dateTimeBetween($startDate = '+2 days', $endDate = '+1 week')->getTimeStamp()) ; $ends_at= Carbon::createFromFormat('Y-m-d H:i:s', $starts_at)->addHours( $faker->numberBetween( 1, 8 ) ); rmobis Adapting the

Populate Django database

久未见 提交于 2019-12-03 12:44:47
问题 I'm developing a Django application which stores user information like their address, phone number, name, etc. I've worked with PHP's Faker library and the seeder included with Laravel. I had been able to populate the database with fake data but now I'm working with Django. I'd like to populate my users table with around 200 entries. But, I don't want the entries to be random strings. I want it to be fake data like I can get with Laravel. I don't know how to do it. What do I need to do to

How to implement your own Faker provider in Laravel

你离开我真会死。 提交于 2019-12-03 12:35:15
I want to create a custom provider for Faker in Laravel (e.g. one for a random building name). Where do I store the custom provider in my application and how do I use it? You should use php artisan to generate the custom provider... On the command line, navigate to the root of your app and type... php artisan make:provider FakerServiceProvider That should generate a new provider in the app/Providers folder. Here is what my register function looks like going off the example in the faker docs. /** * Register the application services. * * @return void */ public function register() { $this->app-

FactoryGirl + Faker - same data being generated for every object in db seed data

孤者浪人 提交于 2019-12-03 08:10:45
问题 I am using FactoryGirl and Faker to generate user objects in my seeds.rb file but for some reason the exact same user is being created and rake db:seed is failing because of an email uniqueness validation. Factory for users: #users.rb require 'faker' FactoryGirl.define do factory :user do first_name Faker::Name.first_name last_name Faker::Name.last_name phone Faker::PhoneNumber.cell_phone email Faker::Internet.email password "password" password_confirmation "password" end end And the code in

Populate Django database

不想你离开。 提交于 2019-12-03 02:13:11
I'm developing a Django application which stores user information like their address, phone number, name, etc. I've worked with PHP's Faker library and the seeder included with Laravel. I had been able to populate the database with fake data but now I'm working with Django. I'd like to populate my users table with around 200 entries. But, I don't want the entries to be random strings. I want it to be fake data like I can get with Laravel. I don't know how to do it. What do I need to do to persist fake data? This is for showing the end user the application with some entries so he can see

FactoryGirl + Faker - same data being generated for every object in db seed data

99封情书 提交于 2019-12-02 21:43:52
I am using FactoryGirl and Faker to generate user objects in my seeds.rb file but for some reason the exact same user is being created and rake db:seed is failing because of an email uniqueness validation. Factory for users: #users.rb require 'faker' FactoryGirl.define do factory :user do first_name Faker::Name.first_name last_name Faker::Name.last_name phone Faker::PhoneNumber.cell_phone email Faker::Internet.email password "password" password_confirmation "password" end end And the code in seeds.rb file: #seeds.rb rand(5..11).times { FactoryGirl.create(:user) } Error: ActiveRecord:

can't load package: github.com/dmgk/faker expects import “syreclabs.com/go/faker”

大憨熊 提交于 2019-12-01 13:22:35
I'm using the github.com/dmgk/faker Go package to generate fake names. But, whenever I try to import the package, I get this error message: can't load package: package github.com/dmgk/faker: code in directory /home/nakama/go_projects/src/github.com/dmgk/faker expects import "syreclabs.com/go/faker" I've read the dmkg/faker page and follow the instruction there by running this: go get -u syreclabs.com/go/faker . I get no error. But when I try to go get -v in my program (which imports dmgk/faker ) it still shows the same error. I also have tried to go build in dmkg/faker , it still generate the

can't load package: github.com/dmgk/faker expects import “syreclabs.com/go/faker”

元气小坏坏 提交于 2019-12-01 10:33:45
问题 I'm using the github.com/dmgk/faker Go package to generate fake names. But, whenever I try to import the package, I get this error message: can't load package: package github.com/dmgk/faker: code in directory /home/nakama/go_projects/src/github.com/dmgk/faker expects import "syreclabs.com/go/faker" I've read the dmkg/faker page and follow the instruction there by running this: go get -u syreclabs.com/go/faker . I get no error. But when I try to go get -v in my program (which imports dmgk

SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2008-03-30 02:56:12'

久未见 提交于 2019-12-01 00:36:42
System Local PHP 5.6.19 App made with Laravel 5.0, using fzaninotto/Faker as seeder Mysql remote Remote MySQL Debian 8 with MariaDB 10.1.13-MariaDB-1~jessie Running seeder php artisan migrate:reset; php artisan migrate; php artisan db:seed After seeder add an indeterminate number of users (different each time the reproduction of the error) get error: [Illuminate\Database\QueryException] SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2008-03-30 02:56:12' for column 'created_at' at row 1 (S QL: insert into `users` (`type`, `name`, `email`, `nick`, `password`, `vat`,