0

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???

Naveed
  • 11,495
  • 2
  • 14
  • 21
zafer
  • 1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Oct 25 '22 at 18:24
  • Please, see how to create a [pandas MRE](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples). People are more likely to give you an answer if they have data on which they can try their ideas. – Ignatius Reilly Oct 25 '22 at 18:25
  • Also, this is not a coding service. **Show your code** and explain exactly where are you stuck (e.g. do you know how to select a slice of rows?). You may want to check the [tour] and [How to Ask](https://stackoverflow.com/help/how-to-ask) – Ignatius Reilly Oct 25 '22 at 18:28

2 Answers2

0
# 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.

The Thonnu
  • 3,578
  • 2
  • 8
  • 30
SKY
  • 175
  • 2
  • 8
0

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..

zafer
  • 1