0

I have a csv file about ETH/USDT like this

Date    Time    Open    High    Low Close   Volume
01/02/2022  00:00:00    2687.99 2707.0  2675.33 2694.25 3800.5367
01/02/2022  00:30:00    2694.25 2697.7  2682.2  2690.08 1830.7036
01/02/2022  01:00:00    2690.09 2703.25 2688.01 2700.46 2777.5885
01/02/2022  01:30:00    2700.46 2701.79 2679.16 2685.87 1649.9632
01/02/2022  02:00:00    2685.99 2700.23 2681.63 2697.38 1907.955
01/02/2022  02:30:00    2697.54 2720.0  2696.81 2716.26 2920.2834
01/02/2022  03:00:00    2716.4  2743.94 2710.75 2736.6  4661.3561
01/02/2022  03:30:00    2736.55 2758.95 2734.46 2753.05 3864.4791
01/02/2022  04:00:00    2753.05 2767.2  2741.28 2744.03 3534.5874
01/02/2022  04:30:00    2744.03 2746.47 2735.66 2744.95 1511.9572
01/02/2022  05:00:00    2744.95 2752.94 2735.16 2736.18 1444.9627
01/02/2022  05:30:00    2736.24 2746.51 2732.99 2734.08 1703.428
01/02/2022  06:00:00    2734.08 2737.69 2719.67 2731.03 2850.1718
01/02/2022  06:30:00    2730.99 2739.72 2730.03 2734.31 1329.2682
01/02/2022  07:00:00    2734.67 2747.49 2733.57 2741.74 1576.231
01/02/2022  07:30:00    2741.75 2745.14 2734.0  2737.47 2317.3336
01/02/2022  08:00:00    2737.48 2749.56 2733.54 2745.5  1723.1117
01/02/2022  08:30:00    2745.5  2766.34 2742.05 2766.07 2766.0808
01/02/2022  09:00:00    2766.23 2797.23 2753.33 2760.48 8239.0367
01/02/2022  09:30:00    2760.74 2761.51 2730.78 2736.58 5027.9459
01/02/2022  10:00:00    2736.58 2746.13 2719.67 2733.72 3321.4038
01/02/2022  10:30:00    2733.91 2744.0  2729.71 2736.92 1618.2212
01/02/2022  11:00:00    2737.11 2763.3  2731.34 2754.65 3030.4406
01/02/2022  11:30:00    2755.02 2770.0  2746.01 2762.65 2164.7044
01/02/2022  12:00:00    2762.54 2784.29 2755.04 2782.69 2742.7342
01/02/2022  12:30:00    2782.65 2789.18 2770.36 2782.52 2745.1542
01/02/2022  13:00:00    2782.32 2799.24 2779.66 2784.14 4015.8807
01/02/2022  13:30:00    2784.14 2805.85 2767.2  2792.75 5983.5428
01/02/2022  14:00:00    2792.75 2813.44 2784.02 2802.66 4633.6066
01/02/2022  14:30:00    2802.65 2810.7  2757.1  2772.46 7749.8085
01/02/2022  15:00:00    2772.64 2774.62 2733.47 2753.64 7528.0202
01/02/2022  15:30:00    2753.86 2771.53 2741.86 2769.63 3962.8567
01/02/2022  16:00:00    2769.58 2789.63 2768.0  2781.52 3496.7291
01/02/2022  16:30:00    2781.43 2815.37 2774.28 2802.8  4007.1236
01/02/2022  17:00:00    2802.96 2809.94 2772.84 2779.4  5218.8638
01/02/2022  17:30:00    2779.42 2787.07 2767.0  2783.19 2838.2632
01/02/2022  18:00:00    2783.28 2796.02 2773.45 2791.84 1895.9605
01/02/2022  18:30:00    2791.81 2801.68 2761.36 2769.58 2620.8094
01/02/2022  19:00:00    2769.6  2778.6  2752.36 2763.3  2655.6939
01/02/2022  19:30:00    2763.51 2770.95 2752.5  2752.71 1886.6582
01/02/2022  20:00:00    2752.69 2777.24 2752.31 2766.87 2288.4418
01/02/2022  20:30:00    2766.63 2787.5  2765.11 2770.93 2597.335
01/02/2022  21:00:00    2771.37 2795.0  2770.86 2792.18 1942.729
01/02/2022  21:30:00    2792.17 2798.92 2777.33 2797.9  2057.262
01/02/2022  22:00:00    2797.91 2805.38 2788.36 2788.87 4395.5921
01/02/2022  22:30:00    2788.86 2789.39 2776.03 2788.9  901.6349
01/02/2022  23:00:00    2788.9  2803.0  2778.01 2798.89 1362.7337
01/02/2022  23:30:00    2798.88 2805.0  2787.43 2788.93 1170.9346
02/02/2022  00:00:00    2788.93 2805.0  2782.61 2792.84 1840.6868
02/02/2022  00:30:00    2792.83 2792.83 2762.4  2774.09 3391.1863
02/02/2022  01:00:00    2773.7  2781.48 2751.3  2757.44 2516.6099
02/02/2022  01:30:00    2757.89 2762.4  2746.79 2758.32 1698.5411
02/02/2022  02:00:00    2758.16 2777.36 2743.2  2774.13 2623.3823
02/02/2022  02:30:00    2774.13 2780.54 2769.17 2776.37 985.1884
02/02/2022  03:00:00    2776.37 2797.1  2775.48 2792.22 2281.6365
02/02/2022  03:30:00    2792.11 2792.22 2780.31 2782.46 917.8514
02/02/2022  04:00:00    2782.45 2782.45 2766.98 2768.41 970.2205
02/02/2022  04:30:00    2768.4  2773.95 2759.03 2761.26 1735.3093
02/02/2022  05:00:00    2761.18 2770.52 2751.31 2756.75 2269.3844
02/02/2022  05:30:00    2756.75 2765.45 2752.23 2765.45 1512.9375
02/02/2022  06:00:00    2765.44 2782.21 2761.24 2774.14 1654.2431
02/02/2022  06:30:00    2774.23 2776.51 2744.53 2754.46 3265.1694
02/02/2022  07:00:00    2754.32 2761.09 2744.17 2760.8  1537.0925
02/02/2022  07:30:00    2760.75 2762.94 2746.22 2750.41 2437.2679
02/02/2022  08:00:00    2750.61 2764.61 2742.0  2757.0  1775.2218
02/02/2022  08:30:00    2757.36 2765.0  2749.19 2764.0  1596.6068
02/02/2022  09:00:00    2764.0  2768.68 2758.01 2763.7  1389.8821
02/02/2022  09:30:00    2763.7  2777.43 2762.44 2776.35 1365.9537
02/02/2022  10:00:00    2776.35 2776.85 2763.0  2770.81 1195.8658
02/02/2022  10:30:00    2770.82 2773.0  2763.09 2765.69 867.9574
02/02/2022  11:00:00    2765.72 2766.34 2754.64 2763.77 1008.5036
02/02/2022  11:30:00    2763.76 2770.55 2757.1  2768.02 773.7525
02/02/2022  12:00:00    2768.23 2800.25 2766.5  2787.27 4316.372
02/02/2022  12:30:00    2787.27 2812.0  2777.85 2802.11 4184.9169
02/02/2022  13:00:00    2802.14 2805.46 2775.61 2786.42 3275.6096
02/02/2022  13:30:00    2786.43 2792.1  2771.85 2775.54 2075.3268
02/02/2022  14:00:00    2775.53 2778.99 2760.0  2771.55 3715.5185
02/02/2022  14:30:00    2771.54 2775.9  2685.79 2688.29 16407.3993
02/02/2022  15:00:00    2687.81 2703.7  2670.24 2677.64 8872.3347
02/02/2022  15:30:00    2678.11 2684.69 2652.87 2665.59 6316.8558
02/02/2022  16:00:00    2665.14 2668.37 2639.86 2658.23 7449.9305
02/02/2022  16:30:00    2658.33 2675.92 2646.28 2670.82 6208.9254
02/02/2022  17:00:00    2670.87 2695.0  2663.49 2680.87 4564.5269
02/02/2022  17:30:00    2680.56 2686.49 2666.22 2686.48 2012.9165
02/02/2022  18:00:00    2686.48 2689.86 2674.17 2679.01 1638.0037
02/02/2022  18:30:00    2679.18 2690.48 2677.27 2687.96 2219.0628
02/02/2022  19:00:00    2687.97 2704.7  2685.67 2702.54 2627.3797
02/02/2022  19:30:00    2702.7  2720.7  2701.77 2708.49 2750.5051
02/02/2022  20:00:00    2708.4  2718.28 2693.42 2707.0  3904.7692
02/02/2022  20:30:00    2707.0  2736.21 2695.08 2728.79 4085.2489
02/02/2022  21:00:00    2729.0  2733.94 2654.4  2679.3  6043.2237
02/02/2022  21:30:00    2679.71 2685.66 2615.0  2655.23 9729.338
02/02/2022  22:00:00    2655.51 2695.16 2644.46 2681.97 5915.5281
02/02/2022  22:30:00    2682.04 2700.0  2678.09 2680.74 1526.5848
02/02/2022  23:00:00    2680.01 2706.64 2673.78 2689.53 2942.9845
02/02/2022  23:30:00    2689.25 2709.32 2671.45 2681.48 3146.3021

I create a function to get lowest price for each day based on Open and Close price (I am not using High and Low price here to calculate them)

Expected:

          Date  Min price   Time
0   01/02/2022    2685.87.  01:30:00
1   02/02/2022    2655.23.  21:30:00

My current code is:

import pandas as pd
df = pd.read_csv('data.csv', sep='\t')

# Find the minimum value of each row based on Open and Close Column
df['min price'] = df[["Open", "Close"]].min(axis=1)

# Group by date and get the minimum price of each day
data = df.groupby(['Date'], as_index=False)['Min price'].min()
print(data)

Actual Output:

          Date  Min price
0   01/02/2022    2685.87
1   02/02/2022    2655.23

How can I show Time column for the each record for the output above. Thanks!

Chau Giang
  • 1,021
  • 9
  • 19

0 Answers0