コード例 #1
0
print('#' * 5 + '地址' + '#' * 5)
address = Address('zh')
print(address.coordinates())
print(address.city())
print('\n')

print('#' * 5 + '地址' + '#' * 5)
business = Business('zh')
print(business.company())
print(business.company_type())
print('\n')

print('#' * 5 + '支付' + '#' * 5)
payment = Payment('zh')
print(payment.paypal())
print(payment.credit_card_expiration_date())
print('\n')

print('#' * 5 + '文字' + '#' * 5)
text = Text('zh')
print(text.alphabet())
print(text.answer())
print(text.quote())
print(text.title())
print(text.word())
print(text.words())
print(text.sentence())
print('\n')

print('#' * 5 + '食物' + '#' * 5)
food = Food('zh')
コード例 #2
0
##################################################

##################################################
### Generate a DataFrame of user information
##################################################
# Generate 10,000 rows of the following:
# user_id, first_name, last_name, email, password, address,
# birth_date, credit_card_num, credit_card_exp, security_answer,
# account_balance

user_df = pd.DataFrame([[x, person.name(), person.surname(), person.gender(),
                        person.email(), hashed_passwd(person.password()),
                        address.address(), person.age(),
                        payment.credit_card_number(),
                        payment.credit_card_expiration_date(), text.word(),
                        account_balance(), np.random.randint(1, 11)]
                        for x in range(10000)])

user_df.columns = ["user_id", "first_name", "last_name",
                   "gender", "email", "password_hashed", "address",
                   "age", "credit_card_num", "credit_card_exp",
                   "security_answer", "account_balance",
                   "marketing_level"]

# Generate sales, based on a noisy linear model
user_df['sales'] = generate_sales(user_df)
user_df['sales'] = user_df['sales'] - user_df['sales'].min()
user_df['sales'] /= 40

print("Summary statistics on numerical data:")