Hi I'm very new to both the forum and python writing language. There is something I would like to ask you, dear group members and masters, and I hope I can express it correctly.
# LOAD BARS 5m
bars = exchange.fetch_ohlcv(symbol, timeframe="5m", since = None, limit = 100)
df = pd.DataFrame(bars, columns=["timestamp", "open", "high", "low", "close", "volume"])
in a dataset (100 rows) expressed in the figure above;
- the smallest value in the last 3 data?
- the smallest value in the last 50 data? within the last 50 data - excluding the most recent data
- the smallest value? in the last 50 data - excluding the 2 most recent data
- the smallest value? the smallest value in the last 50 data - excluding the 3 most recent data?
How can it be written in python???
CodePudding user response:
thanks for answers.
If we update the question to the following figure,
the smallest value in the last 50 data? within the last 50 data - excluding the most recent data, for 'low' columns?
the smallest value? in the last 50 data - excluding the 2 most recent data the smallest value, for 'low' columns?
the smallest value in the last 50 data - excluding the 3 most recent data? for 'low' columns?
thanks for your answers..
CodePudding user response:
# Get last 3 data
df_last_3 = df.tail(3)
# Get Smallest Value
minvalue_series = df_last_3.min()
# To get smallest open values
smallest_open = df_last_3["open"].min()
You can solve the remaining problems like this.