gpt4 book ai didi

python - ipython3 --pylab 从 csv 加载 3960 行但输出被截断

转载 作者:太空宇宙 更新时间:2023-11-03 17:23:49 24 4
gpt4 key购买 nike

我导入一个包含 3960 行的 csv 文件。它是每天采集的 100 个交易品种的数据日志,因此交易品种(第 1 列)每天都会重复(第 0 列)。

这是一天的符号示例。

2015-08-04 02:14:05.249392,AA,0.019310361191284278,0.01935152119607817,0.0249713335081722,30.654248063382706,30.719587545370825,39.640763020966645,0.21314984420108818,29.040674658863264,13524.534781018152,89,57,99

我输入 pandas 命令:

df = pd.read_csv('hvanal2015.csv',names=['date','sym','20sd','10sd','5sd','hv20','hv10','hv5','d2010','d105','dabs','2010rank','105rank','absrank'])

然后“打印出”df,我得到奇怪的输出和丢失的数据?我认为我所做的事情是正确的,将数据加载到数据框中,然后检查一切是否正常,只需在 ipython 中输入 df 即可打印结果?

这是在ipython中输入df的结果

date    sym      20sd      10sd       5sd  0     2015-08-04 02:14:05.249392     AA  0.019310  0.019352  0.024971   
1 2015-08-04 02:14:05.325113 AAPL 0.017051 0.013794 0.010592
2 2015-08-04 02:14:05.415193 AIG 0.008081 0.007330 0.007621
3 2015-08-04 02:14:05.486185 AMZN 0.023565 0.030583 0.009270
4 2015-08-04 02:14:05.551904 APOL 0.024669 0.015697 0.018452
5 2015-08-04 02:14:05.689820 BA 0.011363 0.011968 0.009546
6 2015-08-04 02:14:05.776417 BAC 0.015475 0.013406 0.012332
7 2015-08-04 02:14:05.865606 BBY 0.015891 0.007420 0.005708
8 2015-08-04 02:14:05.946818 BIDU 0.042233 0.055172 0.075642
9 2015-08-04 02:14:06.011993 BMY 0.013811 0.016131 0.009831
10 2015-08-04 02:14:06.089310 BTU 0.081906 0.098044 0.086738
11 2015-08-04 02:14:06.156129 C 0.015506 0.011763 0.006631
12 2015-08-04 02:14:06.296579 CAT 0.016243 0.020149 0.018912
13 2015-08-04 02:14:06.418629 CIEN 0.018688 0.017319 0.013203
14 2015-08-04 02:14:06.484864 CLF 0.087612 0.115459 0.128460
15 2015-08-04 02:14:06.572566 CMCSA 0.012183 0.014665 0.009780
16 2015-08-04 02:14:06.644546 CMG 0.019171 0.023834 0.005643
17 2015-08-04 02:14:06.716458 COH 0.013506 0.012694 0.015716
18 2015-08-04 02:14:06.840608 CRM 0.013037 0.015606 0.011425
19 2015-08-04 02:14:06.967105 DB 0.018022 0.015883 0.015099
20 2015-08-04 02:14:07.043805 DE 0.009732 0.011303 0.011177
21 2015-08-04 02:14:07.114875 EBAY 0.189311 0.009449 0.012621
22 2015-08-04 02:14:07.233759 EEM 0.014977 0.011843 0.013190
23 2015-08-04 02:14:07.313043 EWJ 0.011872 0.005209 0.004348
24 2015-08-04 02:14:07.398756 EWW 0.010863 0.013477 0.009761
25 2015-08-04 02:14:07.467548 EWZ 0.019706 0.020688 0.019828
26 2015-08-04 02:14:07.530146 F 0.014103 0.014731 0.018003
27 2015-08-04 02:14:07.611234 FB 0.018982 0.016290 0.015479
28 2015-08-04 02:14:07.693674 FCX 0.046266 0.061271 0.054798
29 2015-08-04 02:14:07.782691 FDX 0.011408 0.013163 0.013788
... ... ... ... ... ...
3930 2015-09-28 01:00:20.589634 SPY 0.013055 0.010042 0.006734
3931 2015-09-28 01:00:20.655678 TBT 0.019665 0.023604 0.022643
3932 2015-09-28 01:00:20.741748 TGT 0.014070 0.011213 0.009451
3933 2015-09-28 01:00:20.813116 TLT 0.010159 0.012263 0.012021
3934 2015-09-28 01:00:20.884421 TOL 0.017144 0.013470 0.012791
3935 2015-09-28 01:00:20.961626 TSLA 0.018990 0.015661 0.015261
3936 2015-09-28 01:00:21.379167 TWTR 0.022776 0.021697 0.018973
3937 2015-09-28 01:00:21.460016 UAL 0.025244 0.027816 0.017765
3938 2015-09-28 01:00:21.530800 UNG 0.016253 0.013991 0.011630
3939 2015-09-28 01:00:21.611247 USO 0.035293 0.028212 0.023191
3940 2015-09-28 01:00:21.683311 V 0.013683 0.010445 0.010751
3941 2015-09-28 01:00:21.758811 ^VIX 0.079399 0.065535 0.078897
3942 2015-09-28 01:00:21.835376 VLO 0.018881 0.015716 0.010171
3943 2015-09-28 01:00:21.928583 VXX 0.067766 0.064228 0.048297
3944 2015-09-28 01:00:22.008667 WBA 0.015618 0.016432 0.016993
3945 2015-09-28 01:00:22.099665 WFC 0.018403 0.015706 0.013447
3946 2015-09-28 01:00:22.172830 WFM 0.015914 0.015307 0.003510
3947 2015-09-28 01:00:22.268512 WMT 0.013354 0.006830 0.003087
3948 2015-09-28 01:00:22.341328 X 0.028864 0.035593 0.041663
3949 2015-09-28 01:00:22.409256 XHB 0.014366 0.010154 0.008660
3950 2015-09-28 01:00:22.482280 XLE 0.016997 0.016652 0.008939
3951 2015-09-28 01:00:22.559870 XLF 0.014742 0.013247 0.011688
3952 2015-09-28 01:00:22.634289 XLK 0.014146 0.010066 0.009843
3953 2015-09-28 01:00:22.723142 XLU 0.012083 0.009462 0.008826
3954 2015-09-28 01:00:22.794048 XLV 0.015060 0.012652 0.009982
3955 2015-09-28 01:00:22.893138 XOM 0.015312 0.011989 0.008384
3956 2015-09-28 01:00:23.981924 XOP 0.026205 0.025934 0.014844
3957 2015-09-28 01:00:24.065460 XRT 0.155337 0.010598 0.006932
3958 2015-09-28 01:00:24.144621 YHOO 0.018832 0.018856 0.015464
3959 2015-09-28 01:00:24.230014 YUM 0.016179 0.014138 0.007585

hv20 hv10 hv5 d2010 d105 dabs 0 30.654248 30.719588 39.640763 0.213150 29.040675 13524.534781
1 27.067031 21.897596 16.813586 -19.098641 -23.217206 21.564707
2 12.827896 11.635388 12.098524 -9.296211 3.980406 -142.817508
3 37.408190 48.548726 14.716225 29.781006 -69.687722 -334.000562
4 39.161394 24.918185 29.291491 -36.370537 17.550663 -148.255167
5 18.038308 18.999208 15.153943 5.326997 -20.239080 -479.934101
6 24.565501 21.280620 19.575871 -13.371929 -8.010804 -40.092385
7 25.225636 11.778962 9.061472 -53.305591 -23.070705 -56.719915
8 67.042977 87.582752 120.078276 30.636728 37.102652 21.105140
9 21.924209 25.607844 15.605451 16.801678 -39.059880 -332.476061
10 130.022519 155.640574 137.691918 19.702783 -11.532119 -158.530404
11 24.614876 18.673158 10.525944 -24.138731 -43.630613 80.749408
12 25.784506 31.985054 30.021284 24.047577 -6.139650 -125.531261
13 29.666339 27.493848 20.958431 -7.323084 -23.770473 224.596479
14 139.080183 183.285382 203.923987 31.783967 11.260366 -64.572181
15 19.339677 23.279854 15.525712 20.373537 -33.308378 -263.488440
16 30.432227 37.835889 8.957362 24.328361 -76.325752 -413.731577
17 21.439346 20.150395 24.948773 -6.012082 23.812823 -496.082834
18 20.694965 24.773232 18.136937 19.706569 -26.788168 -235.935221
19 28.609026 25.212881 23.968570 -11.870886 -4.935219 -58.425858
20 15.449088 17.942718 17.743381 16.140953 -1.110963 -106.882885
21 300.522219 14.999228 20.034875 -95.008945 33.572708 -135.336365
22 23.775452 18.800884 20.938294 -20.923129 11.368668 -154.335410
23 18.846349 8.268582 6.902262 -56.126345 -16.524235 -70.558862
24 17.245198 21.393317 15.495197 24.053757 -27.569916 -214.617920
25 31.282840 32.840897 31.475970 4.980550 -4.156181 -183.448238
26 22.387271 23.384485 28.578129 4.454376 22.209787 398.605984
27 30.132770 25.859382 24.571435 -14.181865 -4.980577 -64.880664
28 73.444704 97.265239 86.989169 32.433292 -10.564998 -132.574546
29 18.109567 20.896164 21.888316 15.387429 4.748012 -69.143565
... ... ... ... ... ... ...
3930 20.724169 15.941802 10.689522 -23.076279 -32.946592 42.772550
3931 31.217812 37.470711 35.944079 20.029908 -4.074200 -120.340583
3932 22.335940 17.800092 15.002296 -20.307399 -15.717870 -22.600279
3933 16.127509 19.467663 19.082734 20.710909 -1.977275 -109.547023
3934 27.214603 21.382337 20.304794 -21.430647 -5.039407 -76.485045
3935 30.145448 24.860376 24.226530 -17.531908 -2.549624 -85.457236
3936 36.156551 34.442185 30.118402 -4.741508 -12.553740 164.762581
3937 40.073225 44.157307 28.200753 10.191548 -36.135704 -454.565404
3938 25.800946 22.210817 18.462537 -13.914720 -16.875921 21.281067
3939 56.025248 44.785867 36.813963 -20.061280 -17.800044 -11.271643
3940 21.721465 16.580673 17.066158 -23.666875 2.928013 -112.371776
3941 126.042248 104.034079 125.245191 -17.460946 20.388620 -216.766980
3942 29.973334 24.949141 16.146185 -16.762210 -35.283605 110.494953
3943 107.575315 101.958098 76.669257 -5.221660 -24.803170 375.005481
3944 24.792904 26.085561 26.976141 5.213821 3.414073 -34.518798
3945 29.213314 24.932513 21.345969 -14.653597 -14.385006 -1.832930
3946 25.262395 24.299451 5.572292 -3.811766 -77.068238 1921.851267
3947 21.198833 10.842775 4.900851 -48.852021 -54.800770 12.177078
3948 45.819434 56.501595 66.138568 23.313603 17.056107 -26.840535
3949 22.805006 16.118201 13.746766 -29.321656 -14.712774 -49.822840
3950 26.982351 26.434291 14.190090 -2.031179 -46.319384 2180.418856
3951 23.402449 21.028677 18.554475 -10.143262 -11.765848 15.996685
3952 22.456039 15.978894 15.625565 -28.843666 -2.211222 -92.333770
3953 19.181484 15.020811 14.010314 -21.691089 -6.727314 -68.985819
3954 23.906623 20.085022 15.845863 -15.985531 -21.106072 32.032347
3955 24.307415 19.032445 13.309898 -21.701075 -30.067320 38.552214
3956 41.598373 41.169011 23.564185 -1.032162 -42.762323 4042.987059
3957 246.589896 16.824434 11.003777 -93.177160 -34.596450 -62.870246
3958 29.894166 29.932545 24.548939 0.128381 -17.985793 -14109.652460
3959 25.683951 22.443694 12.041074 -12.615881 -46.349857 267.392937

2010rank 105rank absrank
0 89 57 99
1 33 26 75
2 71 42 33
3 2 92 10
4 80 9 31
5 36 63 6
6 53 33 62
7 34 6 57
8 95 93 74
9 9 75 11
10 47 81 29
11 7 20 80
12 59 87 37
13 31 46 86
14 77 95 53
15 15 83 16
16 1 89 8
17 85 49 5
18 24 82 19
19 62 38 56
20 67 73 40
21 92 2 34
22 78 25 30
23 39 4 49
24 23 88 22
25 64 62 25
26 83 60 91
27 61 31 52
28 49 96 35
29 72 72 50
... ... ... ...
3930 26 26 74
3931 66 91 22
3932 53 34 53
3933 71 92 26
3934 64 32 39
3935 67 39 37
3936 59 67 85
3937 19 85 7
3938 52 50 69
3939 51 35 57
3940 81 24 25
3941 93 40 15
3942 21 42 81
3943 37 66 89
3944 83 81 48
3945 57 49 60
3946 1 71 97
3947 4 4 66
3948 90 94 50
3949 56 19 47
3950 8 74 98
3951 60 58 68
3952 69 20 35
3953 63 30 41
3954 42 45 71
3955 30 29 72
3956 10 75 99
3957 23 1 44
3958 50 76 1
3959 7 54 88

[3960 rows x 14 columns]

最佳答案

默认是截断,如果你有几百万行,你不希望它让你的机器/管道长时间崩溃。但这是可配置的:

In [1]: import pandas as pd

In [2]: pd.options.display.max_rows
Out[2]: 15

In [3]: pd.options.display.max_rows = 9999

In [4]: pd.options.display.max_rows
Out[4]: 9999

现在,当您打印 DataFrame 时,它​​将打印整个框架(假设它少于 9999 行)。增加数量需要您自担风险...:)

请参阅options docs .

关于python - ipython3 --pylab 从 csv 加载 3960 行但输出被截断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32831937/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com