0

I'm Printing Live Streaming DataFrame with the Help of Streamz Module, Now I want to Check the Condition of Df.Percentage is Less the 0 then colored should be Red, and if it is greater then 0 then show blue color in each rows. enter image description here

This is my Dataframe with Code.

import numpy as np
import pandas as pd
from streamz.dataframe import PeriodicDataFrame
import time


def random_datapoint(**kwargs):
    read = pd.read_csv(r'C:\Users\krishna gupta\Desktop\live_data_output_file.csv')
    read = read.sort_values('Percentage')
    time.sleep(5)
    return read
df = PeriodicDataFrame(random_datapoint, interval='300ms')
df

Output Should Be -

enter image description here

I don't understand How can I do this, I tried some Code But these Codes aren't working with Live Streaming Code.

and this is my data

Instrument_token    Symbol  Datetime    Last_day_close  Last_trade_price(LTP)   Percentage  Bid_price   Ask_price
4   14246146    NIFTY22MAY17300CE   2022-05-04 13:30:35 230.05  173.00  -24.80  173.15  173.50
3   14245122    NIFTY22MAY17200CE   2022-05-04 13:30:35 276.45  210.50  -23.86  210.30  210.80
5   14241794    NIFTY22MAY17100CE   2022-05-04 13:30:35 331.00  254.20  -23.20  253.40  253.90
2   13468674    BANKNIFTY22MAY36000CE   2022-05-04 13:30:35 974.90  911.95  -6.46   910.00  912.50
1   12150530    BANKNIFTY22MAY29500PE   2022-05-04 13:29:22 11.05   11.00   -0.45   9.60    12.95
0   13467394    BANKNIFTY22MAY35900PE   2022-05-04 13:30:34 716.45  810.65  13.15   822.95  826.75
Krishna Gupta
  • 166
  • 1
  • 10
  • Please do no use images of code/data, provide a DataFrame constructor: [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples). We do not have access to you local files. – mozway May 04 '22 at 07:50
  • @mozway, Thank you for replying, I'm not getting your message completely, but I understand on the basis of that - I provide my code in text form. – Krishna Gupta May 04 '22 at 07:54
  • and also the data as text ;) – mozway May 04 '22 at 07:58
  • @mozway okay. Got it. – Krishna Gupta May 04 '22 at 08:14

0 Answers0