1146112.jpg

度孝子别急出来干你们

GF  2021-03-09 11:18
(百度云和ikun打包一起死吧)

会python的大佬进一下。。。我的数据怎么都变成点点点了

就是那个str(trip……) 之后,我数据咋都没了


889485.png

我叫拉法姆

B1F  2021-03-09 11:27
(拉法姆才是____)
str 说白了是调用 __str__ 方法,让数据源自己决定输出什么,和 print 类似。

而 pandas 在 print 时,为了美观,会在打印大量数据的时候省略中间的部分

你可以看到输出最后面还有一段 pandas 提供的 数据类型提示。
因为这个方法通常是用于生成”给人看“的文字,而不是程序用的数据

引用
display.max_colwidth: [default: 50] [currently: 50]
: int
        The maximum width in characters of a column in the repr of
        a pandas data structure. When the column overflows, a "..."
        placeholder is embedded in the output.


你现在可以通过 df.trip_start_time.dtype 看一下数据内部的具体类型,来决定使用什么方法进行序列化

如果你执意要使用 str 进行序列化,也可以通过提前运行以下代码来开启完整输出


复制代码
  1. pd.set_option('display.max_columns', None)
  2. pd.set_option('display.max_rows', None)
  3. pd.set_option('max_colwidth',999)