I want to convert the 0.5% column to int values (data types)
I have the following table:
TIME                    BID      ASK    0.50%        1%
2020-05-02.20-16-32-016 8983.5  8984    2,946,165   4,334,669
2020-05-02.20-16-37-018 8983.5  8984    5,636,786   6,964,867
2020-05-02.20-16-42-053 8983.5  8984    6,637,055   8,058,007
2020-05-02.20-16-47-054 8981    8981.5  7,624,258   8,965,052
2020-05-02.20-16-52-054 8979.5  8980    7,858,870   8,835,523
I am trying to get a specific values from the 0.5% column, but it is saying it is not an int.
I have the following code:
import pandas as pd
import numpy as np
import plotly.express as px
df = pd.read_csv('quotes.csv')
print(df.dtypes)
df['0.5%'] = df['0.5%'].astype(np.int64)
The 'df.dtypes' gives the following:
TIME          object
BID         float64
ASK         float64
0.5%         object
1%           object
dtype: object
I try to convert the 0.5% column with the code df['0.5%'] = df['0.5%'].astype(np.int64) but it gives me an error invalid literal for int() with base 10: '2,946,165'
