我正在尝试从rails控制台中提取日期,但是当操作最后一次发生时仍会返回nil
检查特定值(expire_at)时
[12] pry(main)> User.last.store_credit
User Load (3.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
StoreCredit Load (2.0ms) SELECT "store_credits".* FROM "store_credits" WHERE "store_credits"."user_id" = $1 LIMIT 1 [["user_id", 2]]
=> #<StoreCredit:0x007fab4b5ba6a0 id: 2, amount: #<BigDecimal:7fab4b5b9930,'0.2E2',9(18)>, user_id: 2, expire_at: nil, last_expired_at: nil, created_at: nil, updated_at: nil>
显示所有字段时
SELECT t.* FROM public.store_credits t
但是当我运行此查询时,我会看到出现的值
In [271]: df
Out[271]:
col1 col2
0 23 33
1 42 11
In [272]: df['col3'] = (df['col1'].map(str) + ',' + df['col2'].map(str))
In [273]: df
Out[273]:
col1 col2 col3
0 23 33 23,33
1 42 11 42,11