简体   繁体   中英

Pandas find highest value after specified index groupby

I have a dataframe of many tickers and dates (Image for illustration only, sample data available on codeshare in link at bottom as it exceeds limit here) 在此处输入图像描述

I want to find the highest value for every ticker on every date, AFTER the lowest value for that day.

For example, in the below image, i would have identified the lowest point as 400 , and only want to find the highest point after that, which will be at around 418 . (Ignore the x axis, i did a quick reset index, the actual index i was going to plot on is the datetime)

在此处输入图像描述

I can find the lowest per day per ticker with the following groupby

df.groupby(['Date','ticker'])['Low'].idxmin()

Which then gives:

在此处输入图像描述

However, how would i be able to specify a groupby that will only return the max after the specified minindex per ticker? or is there another way to go about this?

Sample data:

df = pd.read_json('{"Datetime":{"1505696":1612189800000,"1505697":1612190100000,"1505698":1612190400000,"1505699":1612190700000,"1505700":1612191000000,"1505701":1612191300000,"1505702":1612191600000,"1505703":1612191900000,"1505704":1612192200000,"1505705":1612192500000,"1505706":1612192800000,"1505707":1612193100000,"1505708":1612193400000,"1505709":1612193700000,"1505710":1612194000000,"1505711":1612194300000,"1505712":1612194600000,"1505713":1612194900000,"1505714":1612195200000,"1505715":1612195500000,"1505716":1612195800000,"1505717":1612196100000,"1505718":1612196400000,"1505719":1612196700000,"1505720":1612197000000,"1505721":1612197300000,"1505722":1612197600000,"1505723":1612197900000,"1505724":1612198200000,"1505725":1612198500000,"1505726":1612198800000,"1505727":1612199100000,"1505728":1612199400000,"1505729":1612199700000,"1505730":1612200000000,"1505731":1612200300000,"1505732":1612200600000,"1505733":1612200900000,"1505734":1612201200000,"1505735":1612201500000,"1505736":1612201800000,"1505737":1612202100000,"1505738":1612202400000,"1505739":1612202700000,"1505740":1612203000000,"1505741":1612203300000,"1505742":1612203600000,"1505743":1612203900000,"1505744":1612204200000,"1505745":1612204500000,"1505746":1612204800000,"1505747":1612205100000,"1505748":1612205400000,"1505749":1612205700000,"1505750":1612206000000,"1505751":1612206300000,"1505752":1612206600000,"1505753":1612206900000,"1505754":1612207200000,"1505755":1612207500000,"1505756":1612207800000,"1505757":1612208100000,"1505758":1612208400000,"1505759":1612208700000,"1505760":1612209000000,"1505761":1612209300000,"1505762":1612209600000,"1505763":1612209900000,"1505764":1612210200000,"1505765":1612210500000,"1505766":1612210800000,"1505767":1612211100000,"1505768":1612211400000,"1505769":1612211700000,"1505770":1612212000000,"1505771":1612212300000,"1505772":1612212600000,"1505773":1612212900000,"1534692":1612189800000,"1534693":1612190100000,"1534694":1612190400000,"1534695":1612190700000,"1534696":1612191000000,"1534697":1612191300000,"1534698":1612191600000,"1534699":1612191900000,"1534700":1612192200000,"1534701":1612192500000,"1534702":1612192800000,"1534703":1612193100000,"1534704":1612193400000,"1534705":1612193700000,"1534706":1612194000000,"1534707":1612194300000,"1534708":1612194600000,"1534709":1612194900000,"1534710":1612195200000,"1534711":1612195500000,"1534712":1612195800000,"1534713":1612196100000,"1534714":1612196400000,"1534715":1612196700000,"1534716":1612197000000,"1534717":1612197300000,"1534718":1612197600000,"1534719":1612197900000,"1534720":1612198200000,"1534721":1612198500000,"1534722":1612198800000,"1534723":1612199100000,"1534724":1612199400000,"1534725":1612199700000,"1534726":1612200000000,"1534727":1612200300000,"1534728":1612200600000,"1534729":1612200900000,"1534730":1612201200000,"1534731":1612201500000,"1534732":1612201800000,"1534733":1612202100000,"1534734":1612202400000,"1534735":1612202700000,"1534736":1612203000000,"1534737":1612203300000,"1534738":1612203600000,"1534739":1612203900000,"1534740":1612204200000,"1534741":1612204500000,"1534742":1612204800000,"1534743":1612205100000,"1534744":1612205400000,"1534745":1612205700000,"1534746":1612206000000,"1534747":1612206300000,"1534748":1612206600000,"1534749":1612206900000,"1534750":1612207200000,"1534751":1612207500000,"1534752":1612207800000,"1534753":1612208100000,"1534754":1612208400000,"1534755":1612208700000,"1534756":1612209000000,"1534757":1612209300000,"1534758":1612209600000,"1534759":1612209900000,"1534760":1612210200000,"1534761":1612210500000,"1534762":1612210800000,"1534763":1612211100000,"1534764":1612211400000,"1534765":1612211700000,"1534766":1612212000000,"1534767":1612212300000,"1534768":1612212600000,"1534769":1612212900000,"1960390":1612276200000,"1960391":1612276500000,"1960392":1612276800000,"1960393":1612277100000,"1960394":1612277400000,"1960395":1612277700000,"1960396":1612278000000,"1960397":1612278300000,"1960398":1612278600000,"1960399":1612278900000,"1960400":1612279200000,"1960401":1612279500000,"1960402":1612279800000,"1960403":1612280100000,"1960404":1612280400000,"1960405":1612280700000,"1960406":1612281000000,"1960407":1612281300000,"1960408":1612281600000,"1960409":1612281900000,"1960410":1612282200000,"1960411":1612282500000,"1960412":1612282800000,"1960413":1612283100000,"1960414":1612283400000,"1960415":1612283700000,"1960416":1612284000000,"1960417":1612284300000,"1960418":1612284600000,"1960419":1612284900000,"1960420":1612285200000,"1960421":1612285500000,"1960422":1612285800000,"1960423":1612286100000,"1960424":1612286400000,"1960425":1612286700000,"1960426":1612287000000,"1960427":1612287300000,"1960428":1612287600000,"1960429":1612287900000,"1960430":1612288200000,"1960431":1612288500000,"1960432":1612288800000,"1960433":1612289100000,"1960434":1612289400000,"1960435":1612289700000,"1960436":1612290000000,"1960437":1612290300000,"1960438":1612290600000,"1960439":1612290900000,"1960440":1612291200000,"1960441":1612291500000,"1960442":1612291800000,"1960443":1612292100000,"1960444":1612292400000,"1960445":1612292700000,"1960446":1612293000000,"1960447":1612293300000,"1960448":1612293600000,"1960449":1612293900000,"1960450":1612294200000,"1960451":1612294500000,"1960452":1612294800000,"1960453":1612295100000,"1960454":1612295400000,"1960455":1612295700000,"1960456":1612296000000,"1960457":1612296300000,"1960458":1612296600000,"1960459":1612296900000,"1960460":1612297200000,"1960461":1612297500000,"1960462":1612297800000,"1960463":1612298100000,"1960464":1612298400000,"1960465":1612298700000,"1960466":1612299000000,"1960467":1612299300000,"1989031":1612276200000,"1989032":1612276500000,"1989033":1612276800000,"1989034":1612277100000,"1989035":1612277400000,"1989036":1612277700000,"1989037":1612278000000,"1989038":1612278300000,"1989039":1612278600000,"1989040":1612278900000,"1989041":1612279200000,"1989042":1612279500000,"1989043":1612279800000,"1989044":1612280100000,"1989045":1612280400000,"1989046":1612280700000,"1989047":1612281000000,"1989048":1612281300000,"1989049":1612281600000,"1989050":1612281900000,"1989051":1612282200000,"1989052":1612282500000,"1989053":1612282800000,"1989054":1612283100000,"1989055":1612283400000,"1989056":1612283700000,"1989057":1612284000000,"1989058":1612284300000,"1989059":1612284600000,"1989060":1612284900000,"1989061":1612285200000,"1989062":1612285500000,"1989063":1612285800000,"1989064":1612286100000,"1989065":1612286400000,"1989066":1612286700000,"1989067":1612287000000,"1989068":1612287300000,"1989069":1612287600000,"1989070":1612287900000,"1989071":1612288200000,"1989072":1612288500000,"1989073":1612288800000,"1989074":1612289100000,"1989075":1612289400000,"1989076":1612289700000,"1989077":1612290000000,"1989078":1612290300000,"1989079":1612290600000,"1989080":1612290900000,"1989081":1612291200000,"1989082":1612291500000,"1989083":1612291800000,"1989084":1612292100000,"1989085":1612292400000,"1989086":1612292700000,"1989087":1612293000000,"1989088":1612293300000,"1989089":1612293600000,"1989090":1612293900000,"1989091":1612294200000,"1989092":1612294500000,"1989093":1612294800000,"1989094":1612295100000,"1989095":1612295400000,"1989096":1612295700000,"1989097":1612296000000,"1989098":1612296300000,"1989099":1612296600000,"1989100":1612296900000,"1989101":1612297200000,"1989102":1612297500000,"1989103":1612297800000,"1989104":1612298100000,"1989105":1612298400000,"1989106":1612298700000,"1989107":1612299000000,"1989108":1612299300000},"ticker":{"1505696":"DQ","1505697":"DQ","1505698":"DQ","1505699":"DQ","1505700":"DQ","1505701":"DQ","1505702":"DQ","1505703":"DQ","1505704":"DQ","1505705":"DQ","1505706":"DQ","1505707":"DQ","1505708":"DQ","1505709":"DQ","1505710":"DQ","1505711":"DQ","1505712":"DQ","1505713":"DQ","1505714":"DQ","1505715":"DQ","1505716":"DQ","1505717":"DQ","1505718":"DQ","1505719":"DQ","1505720":"DQ","1505721":"DQ","1505722":"DQ","1505723":"DQ","1505724":"DQ","1505725":"DQ","1505726":"DQ","1505727":"DQ","1505728":"DQ","1505729":"DQ","1505730":"DQ","1505731":"DQ","1505732":"DQ","1505733":"DQ","1505734":"DQ","1505735":"DQ","1505736":"DQ","1505737":"DQ","1505738":"DQ","1505739":"DQ","1505740":"DQ","1505741":"DQ","1505742":"DQ","1505743":"DQ","1505744":"DQ","1505745":"DQ","1505746":"DQ","1505747":"DQ","1505748":"DQ","1505749":"DQ","1505750":"DQ","1505751":"DQ","1505752":"DQ","1505753":"DQ","1505754":"DQ","1505755":"DQ","1505756":"DQ","1505757":"DQ","1505758":"DQ","1505759":"DQ","1505760":"DQ","1505761":"DQ","1505762":"DQ","1505763":"DQ","1505764":"DQ","1505765":"DQ","1505766":"DQ","1505767":"DQ","1505768":"DQ","1505769":"DQ","1505770":"DQ","1505771":"DQ","1505772":"DQ","1505773":"DQ","1534692":"FB","1534693":"FB","1534694":"FB","1534695":"FB","1534696":"FB","1534697":"FB","1534698":"FB","1534699":"FB","1534700":"FB","1534701":"FB","1534702":"FB","1534703":"FB","1534704":"FB","1534705":"FB","1534706":"FB","1534707":"FB","1534708":"FB","1534709":"FB","1534710":"FB","1534711":"FB","1534712":"FB","1534713":"FB","1534714":"FB","1534715":"FB","1534716":"FB","1534717":"FB","1534718":"FB","1534719":"FB","1534720":"FB","1534721":"FB","1534722":"FB","1534723":"FB","1534724":"FB","1534725":"FB","1534726":"FB","1534727":"FB","1534728":"FB","1534729":"FB","1534730":"FB","1534731":"FB","1534732":"FB","1534733":"FB","1534734":"FB","1534735":"FB","1534736":"FB","1534737":"FB","1534738":"FB","1534739":"FB","1534740":"FB","1534741":"FB","1534742":"FB","1534743":"FB","1534744":"FB","1534745":"FB","1534746":"FB","1534747":"FB","1534748":"FB","1534749":"FB","1534750":"FB","1534751":"FB","1534752":"FB","1534753":"FB","1534754":"FB","1534755":"FB","1534756":"FB","1534757":"FB","1534758":"FB","1534759":"FB","1534760":"FB","1534761":"FB","1534762":"FB","1534763":"FB","1534764":"FB","1534765":"FB","1534766":"FB","1534767":"FB","1534768":"FB","1534769":"FB","1960390":"DQ","1960391":"DQ","1960392":"DQ","1960393":"DQ","1960394":"DQ","1960395":"DQ","1960396":"DQ","1960397":"DQ","1960398":"DQ","1960399":"DQ","1960400":"DQ","1960401":"DQ","1960402":"DQ","1960403":"DQ","1960404":"DQ","1960405":"DQ","1960406":"DQ","1960407":"DQ","1960408":"DQ","1960409":"DQ","1960410":"DQ","1960411":"DQ","1960412":"DQ","1960413":"DQ","1960414":"DQ","1960415":"DQ","1960416":"DQ","1960417":"DQ","1960418":"DQ","1960419":"DQ","1960420":"DQ","1960421":"DQ","1960422":"DQ","1960423":"DQ","1960424":"DQ","1960425":"DQ","1960426":"DQ","1960427":"DQ","1960428":"DQ","1960429":"DQ","1960430":"DQ","1960431":"DQ","1960432":"DQ","1960433":"DQ","1960434":"DQ","1960435":"DQ","1960436":"DQ","1960437":"DQ","1960438":"DQ","1960439":"DQ","1960440":"DQ","1960441":"DQ","1960442":"DQ","1960443":"DQ","1960444":"DQ","1960445":"DQ","1960446":"DQ","1960447":"DQ","1960448":"DQ","1960449":"DQ","1960450":"DQ","1960451":"DQ","1960452":"DQ","1960453":"DQ","1960454":"DQ","1960455":"DQ","1960456":"DQ","1960457":"DQ","1960458":"DQ","1960459":"DQ","1960460":"DQ","1960461":"DQ","1960462":"DQ","1960463":"DQ","1960464":"DQ","1960465":"DQ","1960466":"DQ","1960467":"DQ","1989031":"FB","1989032":"FB","1989033":"FB","1989034":"FB","1989035":"FB","1989036":"FB","1989037":"FB","1989038":"FB","1989039":"FB","1989040":"FB","1989041":"FB","1989042":"FB","1989043":"FB","1989044":"FB","1989045":"FB","1989046":"FB","1989047":"FB","1989048":"FB","1989049":"FB","1989050":"FB","1989051":"FB","1989052":"FB","1989053":"FB","1989054":"FB","1989055":"FB","1989056":"FB","1989057":"FB","1989058":"FB","1989059":"FB","1989060":"FB","1989061":"FB","1989062":"FB","1989063":"FB","1989064":"FB","1989065":"FB","1989066":"FB","1989067":"FB","1989068":"FB","1989069":"FB","1989070":"FB","1989071":"FB","1989072":"FB","1989073":"FB","1989074":"FB","1989075":"FB","1989076":"FB","1989077":"FB","1989078":"FB","1989079":"FB","1989080":"FB","1989081":"FB","1989082":"FB","1989083":"FB","1989084":"FB","1989085":"FB","1989086":"FB","1989087":"FB","1989088":"FB","1989089":"FB","1989090":"FB","1989091":"FB","1989092":"FB","1989093":"FB","1989094":"FB","1989095":"FB","1989096":"FB","1989097":"FB","1989098":"FB","1989099":"FB","1989100":"FB","1989101":"FB","1989102":"FB","1989103":"FB","1989104":"FB","1989105":"FB","1989106":"FB","1989107":"FB","1989108":"FB"},"Date":{"1505696":1612137600000,"1505697":1612137600000,"1505698":1612137600000,"1505699":1612137600000,"1505700":1612137600000,"1505701":1612137600000,"1505702":1612137600000,"1505703":1612137600000,"1505704":1612137600000,"1505705":1612137600000,"1505706":1612137600000,"1505707":1612137600000,"1505708":1612137600000,"1505709":1612137600000,"1505710":1612137600000,"1505711":1612137600000,"1505712":1612137600000,"1505713":1612137600000,"1505714":1612137600000,"1505715":1612137600000,"1505716":1612137600000,"1505717":1612137600000,"1505718":1612137600000,"1505719":1612137600000,"1505720":1612137600000,"1505721":1612137600000,"1505722":1612137600000,"1505723":1612137600000,"1505724":1612137600000,"1505725":1612137600000,"1505726":1612137600000,"1505727":1612137600000,"1505728":1612137600000,"1505729":1612137600000,"1505730":1612137600000,"1505731":1612137600000,"1505732":1612137600000,"1505733":1612137600000,"1505734":1612137600000,"1505735":1612137600000,"1505736":1612137600000,"1505737":1612137600000,"1505738":1612137600000,"1505739":1612137600000,"1505740":1612137600000,"1505741":1612137600000,"1505742":1612137600000,"1505743":1612137600000,"1505744":1612137600000,"1505745":1612137600000,"1505746":1612137600000,"1505747":1612137600000,"1505748":1612137600000,"1505749":1612137600000,"1505750":1612137600000,"1505751":1612137600000,"1505752":1612137600000,"1505753":1612137600000,"1505754":1612137600000,"1505755":1612137600000,"1505756":1612137600000,"1505757":1612137600000,"1505758":1612137600000,"1505759":1612137600000,"1505760":1612137600000,"1505761":1612137600000,"1505762":1612137600000,"1505763":1612137600000,"1505764":1612137600000,"1505765":1612137600000,"1505766":1612137600000,"1505767":1612137600000,"1505768":1612137600000,"1505769":1612137600000,"1505770":1612137600000,"1505771":1612137600000,"1505772":1612137600000,"1505773":1612137600000,"1534692":1612137600000,"1534693":1612137600000,"1534694":1612137600000,"1534695":1612137600000,"1534696":1612137600000,"1534697":1612137600000,"1534698":1612137600000,"1534699":1612137600000,"1534700":1612137600000,"1534701":1612137600000,"1534702":1612137600000,"1534703":1612137600000,"1534704":1612137600000,"1534705":1612137600000,"1534706":1612137600000,"1534707":1612137600000,"1534708":1612137600000,"1534709":1612137600000,"1534710":1612137600000,"1534711":1612137600000,"1534712":1612137600000,"1534713":1612137600000,"1534714":1612137600000,"1534715":1612137600000,"1534716":1612137600000,"1534717":1612137600000,"1534718":1612137600000,"1534719":1612137600000,"1534720":1612137600000,"1534721":1612137600000,"1534722":1612137600000,"1534723":1612137600000,"1534724":1612137600000,"1534725":1612137600000,"1534726":1612137600000,"1534727":1612137600000,"1534728":1612137600000,"1534729":1612137600000,"1534730":1612137600000,"1534731":1612137600000,"1534732":1612137600000,"1534733":1612137600000,"1534734":1612137600000,"1534735":1612137600000,"1534736":1612137600000,"1534737":1612137600000,"1534738":1612137600000,"1534739":1612137600000,"1534740":1612137600000,"1534741":1612137600000,"1534742":1612137600000,"1534743":1612137600000,"1534744":1612137600000,"1534745":1612137600000,"1534746":1612137600000,"1534747":1612137600000,"1534748":1612137600000,"1534749":1612137600000,"1534750":1612137600000,"1534751":1612137600000,"1534752":1612137600000,"1534753":1612137600000,"1534754":1612137600000,"1534755":1612137600000,"1534756":1612137600000,"1534757":1612137600000,"1534758":1612137600000,"1534759":1612137600000,"1534760":1612137600000,"1534761":1612137600000,"1534762":1612137600000,"1534763":1612137600000,"1534764":1612137600000,"1534765":1612137600000,"1534766":1612137600000,"1534767":1612137600000,"1534768":1612137600000,"1534769":1612137600000,"1960390":1612224000000,"1960391":1612224000000,"1960392":1612224000000,"1960393":1612224000000,"1960394":1612224000000,"1960395":1612224000000,"1960396":1612224000000,"1960397":1612224000000,"1960398":1612224000000,"1960399":1612224000000,"1960400":1612224000000,"1960401":1612224000000,"1960402":1612224000000,"1960403":1612224000000,"1960404":1612224000000,"1960405":1612224000000,"1960406":1612224000000,"1960407":1612224000000,"1960408":1612224000000,"1960409":1612224000000,"1960410":1612224000000,"1960411":1612224000000,"1960412":1612224000000,"1960413":1612224000000,"1960414":1612224000000,"1960415":1612224000000,"1960416":1612224000000,"1960417":1612224000000,"1960418":1612224000000,"1960419":1612224000000,"1960420":1612224000000,"1960421":1612224000000,"1960422":1612224000000,"1960423":1612224000000,"1960424":1612224000000,"1960425":1612224000000,"1960426":1612224000000,"1960427":1612224000000,"1960428":1612224000000,"1960429":1612224000000,"1960430":1612224000000,"1960431":1612224000000,"1960432":1612224000000,"1960433":1612224000000,"1960434":1612224000000,"1960435":1612224000000,"1960436":1612224000000,"1960437":1612224000000,"1960438":1612224000000,"1960439":1612224000000,"1960440":1612224000000,"1960441":1612224000000,"1960442":1612224000000,"1960443":1612224000000,"1960444":1612224000000,"1960445":1612224000000,"1960446":1612224000000,"1960447":1612224000000,"1960448":1612224000000,"1960449":1612224000000,"1960450":1612224000000,"1960451":1612224000000,"1960452":1612224000000,"1960453":1612224000000,"1960454":1612224000000,"1960455":1612224000000,"1960456":1612224000000,"1960457":1612224000000,"1960458":1612224000000,"1960459":1612224000000,"1960460":1612224000000,"1960461":1612224000000,"1960462":1612224000000,"1960463":1612224000000,"1960464":1612224000000,"1960465":1612224000000,"1960466":1612224000000,"1960467":1612224000000,"1989031":1612224000000,"1989032":1612224000000,"1989033":1612224000000,"1989034":1612224000000,"1989035":1612224000000,"1989036":1612224000000,"1989037":1612224000000,"1989038":1612224000000,"1989039":1612224000000,"1989040":1612224000000,"1989041":1612224000000,"1989042":1612224000000,"1989043":1612224000000,"1989044":1612224000000,"1989045":1612224000000,"1989046":1612224000000,"1989047":1612224000000,"1989048":1612224000000,"1989049":1612224000000,"1989050":1612224000000,"1989051":1612224000000,"1989052":1612224000000,"1989053":1612224000000,"1989054":1612224000000,"1989055":1612224000000,"1989056":1612224000000,"1989057":1612224000000,"1989058":1612224000000,"1989059":1612224000000,"1989060":1612224000000,"1989061":1612224000000,"1989062":1612224000000,"1989063":1612224000000,"1989064":1612224000000,"1989065":1612224000000,"1989066":1612224000000,"1989067":1612224000000,"1989068":1612224000000,"1989069":1612224000000,"1989070":1612224000000,"1989071":1612224000000,"1989072":1612224000000,"1989073":1612224000000,"1989074":1612224000000,"1989075":1612224000000,"1989076":1612224000000,"1989077":1612224000000,"1989078":1612224000000,"1989079":1612224000000,"1989080":1612224000000,"1989081":1612224000000,"1989082":1612224000000,"1989083":1612224000000,"1989084":1612224000000,"1989085":1612224000000,"1989086":1612224000000,"1989087":1612224000000,"1989088":1612224000000,"1989089":1612224000000,"1989090":1612224000000,"1989091":1612224000000,"1989092":1612224000000,"1989093":1612224000000,"1989094":1612224000000,"1989095":1612224000000,"1989096":1612224000000,"1989097":1612224000000,"1989098":1612224000000,"1989099":1612224000000,"1989100":1612224000000,"1989101":1612224000000,"1989102":1612224000000,"1989103":1612224000000,"1989104":1612224000000,"1989105":1612224000000,"1989106":1612224000000,"1989107":1612224000000,"1989108":1612224000000},"Close":{"1505696":96.5,"1505697":99.6500015259,"1505698":99.6449966431,"1505699":98.2300033569,"1505700":96.3724975586,"1505701":97.4199981689,"1505702":96.6500015259,"1505703":94.75,"1505704":95.4000015259,"1505705":95.8500976562,"1505706":97.7600021362,"1505707":98.4599990845,"1505708":98.2900009155,"1505709":98.5699996948,"1505710":99.7200012207,"1505711":98.9199981689,"1505712":99.3099975586,"1505713":98.8799972534,"1505714":99.9999008179,"1505715":98.9623031616,"1505716":98.7799987793,"1505717":98.6900024414,"1505718":99.1384963989,"1505719":98.9300003052,"1505720":98.9400024414,"1505721":99.0299987793,"1505722":98.9499969482,"1505723":98.9401016235,"1505724":99.6900024414,"1505725":100.2900009155,"1505726":100.7399978638,"1505727":101.0500030518,"1505728":100.8899993896,"1505729":100.7900009155,"1505730":100.8799972534,"1505731":100.9400024414,"1505732":100.9599990845,"1505733":101.1699981689,"1505734":101.8600006104,"1505735":102.1800003052,"1505736":102.0999984741,"1505737":101.8000030518,"1505738":101.7301025391,"1505739":102.8299026489,"1505740":103.1800003052,"1505741":102.4000015259,"1505742":103.5,"1505743":103.4400024414,"1505744":103.0082015991,"1505745":102.7200012207,"1505746":103.2099990845,"1505747":103.085899353,"1505748":103.3300018311,"1505749":103.6399993896,"1505750":103.2450027466,"1505751":103.8199996948,"1505752":104.2620010376,"1505753":103.5,"1505754":103.6100006104,"1505755":104.0849990845,"1505756":103.6900024414,"1505757":103.9100036621,"1505758":103.602897644,"1505759":103.5199966431,"1505760":103.3700027466,"1505761":102.8899993896,"1505762":102.6999969482,"1505763":102.9100036621,"1505764":102.8600006104,"1505765":102.6999969482,"1505766":103.0,"1505767":102.7900009155,"1505768":103.466003418,"1505769":102.9599990845,"1505770":102.8199996948,"1505771":102.7600021362,"1505772":103.1350021362,"1505773":103.4000015259,"1534692":260.3200073242,"1534693":258.8200073242,"1534694":257.4417114258,"1534695":256.3500061035,"1534696":255.8650054932,"1534697":255.75,"1534698":255.8000030518,"1534699":256.3200073242,"1534700":257.0100097656,"1534701":257.9450073242,"1534702":258.825012207,"1534703":259.3599853516,"1534704":258.3800048828,"1534705":257.8182983398,"1534706":259.0,"1534707":258.5354919434,"1534708":256.799987793,"1534709":257.0700073242,"1534710":257.1099853516,"1534711":257.6300048828,"1534712":256.9599914551,"1534713":257.3299865723,"1534714":257.7349853516,"1534715":258.399597168,"1534716":258.6549987793,"1534717":258.625,"1534718":258.6874084473,"1534719":259.2301025391,"1534720":259.1499938965,"1534721":259.1449890137,"1534722":259.799987793,"1534723":260.700012207,"1534724":261.9263916016,"1534725":261.6801147461,"1534726":262.6600036621,"1534727":261.6950073242,"1534728":261.469909668,"1534729":261.7799987793,"1534730":261.3200073242,"1534731":261.6000061035,"1534732":262.3900146484,"1534733":262.749206543,"1534734":261.8099975586,"1534735":262.2900085449,"1534736":262.0849914551,"1534737":262.6350097656,"1534738":263.0799865723,"1534739":262.9599914551,"1534740":263.1951904297,"1534741":262.8599853516,"1534742":262.9800109863,"1534743":263.2799987793,"1534744":263.3599853516,"1534745":263.7712097168,"1534746":263.6799926758,"1534747":263.9400024414,"1534748":263.4700012207,"1534749":263.4899902344,"1534750":263.1050109863,"1534751":263.3800048828,"1534752":263.674987793,"1534753":263.4949951172,"1534754":263.5799865723,"1534755":263.7898864746,"1534756":263.5400085449,"1534757":263.0599060059,"1534758":263.1199951172,"1534759":263.1000061035,"1534760":262.9450073242,"1534761":263.3193969727,"1534762":263.0199890137,"1534763":262.9049987793,"1534764":262.9901123047,"1534765":262.8114929199,"1534766":262.950012207,"1534767":263.1149902344,"1534768":263.6499938965,"1534769":261.9899902344,"1960390":110.0,"1960391":106.6299972534,"1960392":107.2099990845,"1960393":107.9300003052,"1960394":106.3899993896,"1960395":105.9899978638,"1960396":106.3899993896,"1960397":107.608001709,"1960398":106.6449966431,"1960399":107.0199966431,"1960400":107.1292037964,"1960401":104.1999969482,"1960402":106.7300033569,"1960403":106.4199981689,"1960404":106.6399993896,"1960405":106.5699996948,"1960406":107.0950012207,"1960407":107.1149978638,"1960408":107.8100967407,"1960409":109.6800003052,"1960410":109.1299972534,"1960411":110.5199966431,"1960412":110.7699966431,"1960413":111.4449996948,"1960414":111.8949966431,"1960415":113.0999984741,"1960416":113.5599975586,"1960417":114.5400009155,"1960418":114.5699996948,"1960419":114.3399963379,"1960420":112.3399963379,"1960421":113.8600006104,"1960422":114.1800003052,"1960423":113.5103988647,"1960424":114.4300003052,"1960425":114.757598877,"1960426":114.6999969482,"1960427":114.8199996948,"1960428":114.8499984741,"1960429":114.6999969482,"1960430":113.0383987427,"1960431":113.3040008545,"1960432":113.6999969482,"1960433":114.1393966675,"1960434":114.5100021362,"1960435":113.8499984741,"1960436":113.3499984741,"1960437":113.6500015259,"1960438":113.8099975586,"1960439":114.5,"1960440":114.8700027466,"1960441":114.9899978638,"1960442":115.3349990845,"1960443":115.9649963379,"1960444":117.4558029175,"1960445":116.9749984741,"1960446":116.7649993896,"1960447":116.1100006104,"1960448":115.9968032837,"1960449":116.0667037964,"1960450":116.4100036621,"1960451":116.0899963379,"1960452":116.75,"1960453":117.3600006104,"1960454":116.9700012207,"1960455":117.4300003052,"1960456":117.6299972534,"1960457":117.5903015137,"1960458":117.2549972534,"1960459":117.8000030518,"1960460":118.1699981689,"1960461":118.5,"1960462":117.5236968994,"1960463":116.9400024414,"1960464":116.4599990845,"1960465":116.0999984741,"1960466":115.9800033569,"1960467":115.8399963379,"1989031":263.9899902344,"1989032":265.3099975586,"1989033":265.1000061035,"1989034":266.6600036621,"1989035":265.4100036621,"1989036":265.8399963379,"1989037":265.3999938965,"1989038":265.8999938965,"1989039":265.8200073242,"1989040":267.6099853516,"1989041":266.7900085449,"1989042":265.9700012207,"1989043":266.1047058105,"1989044":267.1700134277,"1989045":266.9599914551,"1989046":266.9349975586,"1989047":266.2699890137,"1989048":265.7575073242,"1989049":265.9299926758,"1989050":265.9400024414,"1989051":265.7900085449,"1989052":266.6000061035,"1989053":266.6400146484,"1989054":267.6700134277,"1989055":267.700012207,"1989056":267.3793029785,"1989057":267.7950134277,"1989058":268.1499938965,"1989059":268.3008117676,"1989060":268.1499938965,"1989061":267.7550048828,"1989062":267.9700012207,"1989063":268.2334899902,"1989064":268.4299926758,"1989065":268.3299865723,"1989066":268.4898986816,"1989067":268.6517028809,"1989068":268.5199890137,"1989069":268.6600036621,"1989070":268.0400085449,"1989071":268.0400085449,"1989072":268.4100036621,"1989073":268.1600036621,"1989074":268.0849914551,"1989075":268.4200134277,"1989076":267.8900146484,"1989077":267.625,"1989078":267.7950134277,"1989079":268.0199890137,"1989080":268.3049926758,"1989081":268.4447937012,"1989082":268.2182006836,"1989083":267.9800109863,"1989084":268.0599975586,"1989085":267.6300048828,"1989086":267.422088623,"1989087":267.4200134277,"1989088":267.5100097656,"1989089":267.1700134277,"1989090":266.9949951172,"1989091":266.7099914551,"1989092":267.450012207,"1989093":267.7715148926,"1989094":268.0,"1989095":267.8999938965,"1989096":267.5700073242,"1989097":267.6400146484,"1989098":267.0100097656,"1989099":267.3800048828,"1989100":267.6000061035,"1989101":267.6300048828,"1989102":267.9200134277,"1989103":267.9450073242,"1989104":268.1000061035,"1989105":267.75,"1989106":267.9299926758,"1989107":267.5100097656,"1989108":267.0}}')

This should do the trick:

def lo_hi(df):
    ix_lo = df['Close'].idxmin()
    ix_hi = df.loc[df.index>=ix_lo, 'Close'].idxmax()
    return ix_lo, ix_hi

df.groupby(['Date','ticker']).apply(lo_hi)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM