I found a very strange anamoly of a code working on Jupyter notebook, but its not working on the app.python from a flask applicatoin.

When the type of column names if int instead of string, the str.replace() code works on the jupyter notebook, but does not work in the flask python.


Scenario: I have a dataframe having year-months(For example 202001, 202002 etc.) as the column name.


Now I want to have a replace code, like,

col = [ '201911', '201912','202001', '202002', '202003', '202004', '202005', '202006', '202007', '202008','202009','202010'] 

the below code works on the jupyter notebook, but fails on the flask.

data_df[col] = data_df[col].replace(to_replace=['-',' ','\*'], value='', regex=True).astype(float)


Comments

Popular posts from this blog