Customer segmentation using RFM analysis
This can be done a lot simpler.

Since all of rfm returns in result, you can do a copy. To make sure that even if you reorder things, they appear at the correct place, you use an index. Since Id is unique in the DataFrame, let's use this

result2 = datas.set_index("Id")


r_score

There is no use for the intermediate rfm_recency, or it's sorting, so including the r_score can be as simple as:

result2["r_score"] = 5 - pd.qcut(result2["Recency"], q=5, labels=False)


Doing this immediately in this result2 DataFrame instead of joining several intermediary DataFrames together.

f_score and m_score

The f_score and m_score are both linear interpolations, so can be done with this formula, instead of applying the scorefm method on each row individually

def fm_score(series):
    return (
        6 - series.sort_values(ascending=False).cumsum() / series.sum() * 5
    ).astype(int)

result2["f_score"] = fm_score(result2["Frequency"])
result2["m_score"] = fm_score(result2["Monetary"])


FM and RFM_Score

These are simple calculations, so can be done like this: 

result2["FM"] = (result2["f_score"] + result2["m_score"]) / 2
result2["RFM_Score"] = result2["r_score"] * 10 + result2["FM"]


This can be all you need. If the shape needs to be exactly as the original result, a reset_index, sort and reindex can help:

result2 = result2.sort_index().reset_index().reindex(columns=result.columns)


where instead of result.columns you manually give a list of the columns in order

    Max_Date    Id  Member_id   Recency r_score Frequency   f_score Monetary    m_score FM  RFM_Score
0   2019-02-10  123 qwbe78  3   5   83  1   9251    2   1.5 51.5
1   2019-02-10  147 jkyu87  3   5   32  1   8678    2   1.5 51.5
2   2019-01-18  258 fwgs77  26  3   132 1   18100   3   2.0 32.0
3   2019-01-12  369 fbbr54  32  3   197 1   1019    1   1.0 31.0
4   2018-04-15  445 asfv41  304 1   246 2   10215   2   2.0 12.0
5   2019-01-21  456 dwfv84  23  4   261 2   4221    1   1.5 41.5
6   2018-04-10  589 sdqw88  309 1   80  1   19569   4   2.5 12.5
7   2018-05-20  741 dsdg46  269 2   282 3   3108    1   2.0 22.0
8   2019-02-05  753 yukh20  8   5   132 1   19871   5   3.0 53.0
9   2018-03-19  784 asdf48  331 1   413 4   8551    1   2.5 12.5
10  2019-01-25  789 adqw87  19  4   478 5   19195   3   4.0 44.0
11  2018-06-30  852 cvgo87  228 2   261 2   5975    1   1.5 21.5
12  2019-01-19  963 ewgs45  25  4   357 4   4405    1   2.5 42.5
13  2018-01-04  988 afdi25  40  2   321 3   3753    1   2.0 22.0