0

basically I have 2 diferents codes but both do the same, should i do it one way or the other, whats is the diference

import pandas as pd
data = pd.read_excel('AAPL.xlsx',sheet_name="Hoja1")
data['intra'] = (((data['close'])/data['open']-1)*100)
data

what is the diference between this code and the following

import pandas as pd
data = pd.read_excel('AAPL.xlsx',sheet_name="Hoja1")
data['intra'] = ((data.close / data.open -1)*100)
data
wjandrea
  • 23,210
  • 7
  • 49
  • 68
Tibu
  • 1
  • 2
    IMO, _always_ use the bracket notation `[]`. Using the `.` attribute access causes so many unforeseen problems – G. Anderson Jan 18 '22 at 23:15

0 Answers0