0

I am a real noob in Python so at first I wanna excuse me for this question. I'm writing this down:

Code:

import pandas as pd
import numpy as np
from scipy.signal import argrelextrema
import matplotlib.pyplot as plt

data = pd.read_csv('USDJPY.csv')
data.columns = [['Date', 'open', 'high', 'low', 'close', 'vol']]
data = data.drop_duplicates(keep=False)
data.Date = pd.to_datetime(data.Date,format='%d.%m.%Y %H:%M:%S.%f')
data = data.set_index(data.Date)
data = data[['open', 'high', 'low', 'close', 'vol']]`

But I always get this: Type Error: only integer scalar arrays can be converted to a scalar index

Can you please help me?

The .csv file contains USDJPY historical data

  • Welcome to stack overflow! Please [edit] to include the full traceback of the error in the text of your post, as that can help diagnose the issue. It would also help to see samples of your data, please see [How to make good pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – G. Anderson Jan 08 '20 at 22:08
  • Try maybe ```data.set_index(pd.DatetimeIndex(data["Date"]))``` – Grzegorz Skibinski Jan 08 '20 at 22:21
  • Does this answer your question? [How do I properly set the Datetimeindex for a Pandas datetime object in a dataframe?](https://stackoverflow.com/questions/27032052/how-do-i-properly-set-the-datetimeindex-for-a-pandas-datetime-object-in-a-datafr) – Grzegorz Skibinski Jan 08 '20 at 22:22

0 Answers0