Encerrado

Python Panda: Modify Dataframe with mask and create new Dataframe

I have the following df of 10 million rows:

Super speed is essential to this project, so please only apply if you know the fastest techniques to do this project.

date price MA1 MA2 MA3

date0 price0 12 10 8

date1 price1 11 11 11

date2 price2 12 21 14

date3 price3 13 12 15

date4 price4 14 14 14

date5 price5 15 17 14

date6 price6 19 16 15

date7 price7 15 12 13

date8 price8 11 10 13

date9 price9 21 12 13

date10 price10 13 11 14

date11 price11 14 14 14

date12 price12 16 16 16

date13 price13 34 32 23

date14 price14 12 12 12

I have the following df:

date price MA1 MA2 MA3

date0 price0 12 10 8

date1 price1 11 11 11

date2 price2 12 21 14

date3 price3 13 12 15

date4 price4 14 14 14

date5 price5 15 17 14

date6 price6 19 16 15

date7 price7 15 12 13

date8 price8 11 10 13

date9 price9 21 12 13

date10 price10 13 11 14

date11 price11 14 14 14

date12 price12 16 16 16

date13 price13 34 32 23

date14 price14 12 12 12

I filter my df using the following mask:

df =(data

.assign(same=lambda x: (x['MA1'] == x['MA2']) & (x['MA1'] == x['MA3']))

.loc[lambda x: [login to view URL] == True]

)

I get:

date price MA1 MA2 MA3

date1 price1 11 11 11

date4 price4 14 14 14

date11 price11 14 14 14

date12 price12 16 16 16

date14 price14 12 12 12

So the dates where MA1, MA2 and M3 are matching are date1, date4, date11, date 12, date14.

I would like to create a df which matches this format

date price price_past price_fut return_past return_future

date1 price1 price0 price2 (price1-price0)/price0 (price2-price1)/price1

date4 price4 price3 price5 (price4-price3)/price3 (price5-price4)/price4

date11 price11 price10 price12 (price11-price10)/price10 (price12-price11)/price11

date12 price12 price11 price13 (price12-price11)/price11 (price13 -price12)/price12

date14 price14 price13 price15 (price14-price13)/price13 (price15-price14)/price14

Then i want to get statistics on the number of rows where returns are of the same sign. (percentage, counts, etc..)

I would like then to extend the number of lookback and forward looking prices i incorporate in the statistic computation.. So for instance here I use 1 price back 1 price forward. I would like to be able to set the number of how many prices I choose to select. Thanks

Habilidades: Python, Pandas, NumPy

Sobre o Cliente:
( 22 comentários ) new york, United States

ID do Projeto: #34781215

43 freelancers estão ofertando em média $166 nesse trabalho

(26 Comentários)
7.3
saubhagyamweb

Hi Mate, I am glad to inform you that we have a strong 6+ years of quality experience in Software Development. I do have the necessary skill set & resources to complete this project. I have done this kind of project Mais

$250 USD in 7 dias
(35 Comentários)
6.6
(65 Comentários)
7.0
schoudhary1553

Top 1% in Freelancer.com Hi, Greetings! ✅checked your project details: ✅Completed Time: In project deadline We have worked on 850 + Projects. I have 6 + years of the experience in same kind of projects. If you Mais

$220 USD in 5 dias
(84 Comentários)
6.8
liveexperts123

Hi there,I'm biddin on your project "Python Panda: Modify Dataframe with mask and create new Dataframe" I have read your project description and i'm an expert in Python and machine learning therefore i can do this proj Mais

$250 USD in 3 dias
(25 Comentários)
6.5
ThanassisKalv

Hello, I am Python developer and I have created performant scripts in Pandas, I think I can do what you need efficiently. Let me recap what I get from your description, you still want your formula to be applied so that Mais

$230 USD in 5 dias
(116 Comentários)
6.5
(82 Comentários)
6.1
(4 Comentários)
5.6
fosemav215

Hi, I can modify the pandas dataframe as you wanted. ping me to discuss more of it. Thank you

$100 USD em 1 dia
(31 Comentários)
5.1
helgekrueger

Hi. I'm a developer with a decade of experience of using pandas in projects. If I understand your problem correctly, I will be able to create a solution in a few lines of codes within a few hours. It might even beat y Mais

$50 USD em 1 dia
(18 Comentários)
5.0
mohamedabdelall4

Hi, I am artificial intelligence engineer with more 8 years of experience in Data Science & Machine/Deep Learning Feel free to contact me for further details I have the hardware required to accomplish this job..Bid Amo Mais

$140 USD in 7 dias
(19 Comentários)
5.2
opensysknw

Hello, I have gone through the requirements mentioned by you for your project - Python Panda: Modify Dataframe with mask and create new Dataframe. Let us chat on - [login to view URL] in details about your project Mais

$140 USD in 7 dias
(25 Comentários)
4.8
Valuesolutions

Hello, I hope this finds you well. I have just seen your project requiring; Python NumPy Pandas I believe that my 10-year experience in this field is what you need right away. Avoid the headache of looking further. L Mais

$150 USD in 3 dias
(15 Comentários)
5.7
LongVuDinh

Hello, Client! Thanks for giving the opportunity to work for you. I have read your project description very carefully, and understood what you want. I have a deep understanding and experience in the areas of python tha Mais

$140 USD in 7 dias
(7 Comentários)
4.7
rexzetsolutions

yeah i m expert with the python so as i got your task ready to start work from now

$300 USD em 1 dia
(17 Comentários)
5.3
vw7534121vw

Hello, I think what you would like for this project is to use Dask instead of Pandas as it will split the data into chunks and do the computations in parallel. Depending on how many cores you have on your machine, thi Mais

$200 USD in 3 dias
(5 Comentários)
4.5
WIFTCAP

Hello. Greetings from WIFTCAP. WIFTCAP began its journey 5 yrs. ago. Since then, we started focusing on client's specific requirements and on time delivery. We have expert Python developers with 2 to 7 years of experi Mais

$250 USD in 30 dias
(23 Comentários)
5.1
karlmarkus609

Hello, I read your description carefully. I have rich experience with Python programming and algorithm research. Your projects seem interesting to me!! I have understood your issue. but I need your database to test. Mais

$150 USD in 3 dias
(9 Comentários)
4.0
anenkovakateryna

Hi I have 5 years of experience in <<< python >>>, so I became an expert that fits perfectly with your requirement fields. I've read the project description carefully. It would be a great pleasure for me to have the Mais

$50 USD em 1 dia
(6 Comentários)
4.1
alamineee

Hi, Dear Employer, I have read your job post carefully. I can write clean validated Machine Learning code and make a device-supported M. File. I have over 10+ years of experience at the ✔Machine Learning (ML) ✔Python Mais

$500 USD in 3 dias
(20 Comentários)
4.7