0

I am new to VAEX. Also I couldn't find any solution for my specific question in google. So I am asking here hoping someone can solve my issue :).

I am using VAEX to import data from CSV file in my DASH Plotly app and then want to convert Date column to datetime format within VAEX. It successfully imports the data from csv file. Here is how I imported data from csv into VAEX:

vaex_df=vaex.from_csv(link,convert=True,chunk_size=5_000)

Below it shows the type of the Date column after importing into VAEX. As you can see, it takes the Date column as string type.

enter image description here

Then when I try to change data type of Date columns with below code, it gives error:

vaex_df['Date']=vaex_df['Date'].astype('datetime64[ns]')

enter image description here

I dont know how to handle this issue, so I need your help. What am I doing wrong here? Thanks in advance

1 Answers1

0

The vaex.from_csv is basically an alias to pandas.read_csv. In pandas.read_csv there is an argument that use can use to specify which columns should be parsed as datetime. Just pass that very same argument to vaex.from_csv and you should be good to go!

Joco
  • 803
  • 4
  • 7