簡體   English   中英

Python 反相 dataframe 行

[英]Python inverting dataframe rows

我正在嘗試使用 iloc 反轉 yfinance dataframe 的行,但它不起作用

import yfinance as yf
import pandas as pd

s1 = 'AAPL'

a=yf.download(s1, period = '1d', interval = '1m')
a.iloc[::-1]

print(a)

output:

2020-08-17 15:56:00-04:00  459.274994  459.320007  458.829987  458.920013  458.920013   149501
2020-08-17 15:57:00-04:00  458.920013  458.950012  458.589996  458.890015  458.890015   147451
2020-08-17 15:58:00-04:00  458.859985  458.889587  458.390015  458.660004  458.660004   132868
2020-08-17 15:59:00-04:00  458.700012  458.850006  458.000000  458.329987  458.329987   442095

我正在尋找從頂部最新到底部最早的 go 的時間。

我正在嘗試使用 iloc 反轉 yfinance dataframe 的行,但它不起作用

import yfinance as yf
import pandas as pd

s1 = 'AAPL'

a=yf.download(s1, period = '1d', interval = '1m')
a.iloc[::-1]

print(a)

output:

2020-08-17 15:56:00-04:00  459.274994  459.320007  458.829987  458.920013  458.920013   149501
2020-08-17 15:57:00-04:00  458.920013  458.950012  458.589996  458.890015  458.890015   147451
2020-08-17 15:58:00-04:00  458.859985  458.889587  458.390015  458.660004  458.660004   132868
2020-08-17 15:59:00-04:00  458.700012  458.850006  458.000000  458.329987  458.329987   442095

我正在尋找從頂部最新到底部最早的 go 的時間。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM