Reputation: 45
import csv
import pandas as pd
from pandas import DataFrame
col_list = ["Solicitud"]
daf = pd.read_csv(r"C:\Users\N\inapi_scraper\solicitudes_v0.csv", usecols=[0], names=['Solicitud'], header=None)#, usecols=col_list)
datf=daf[0:737]
df[datf] = df[datf].astype(dtype=int)
I always receive this error:
TypeError: 'type' object is not subscriptable
Upvotes: 0
Views: 172
Reputation: 120409
datf
is already a dataframe and not a mask (and df
does not exist?)
datf = daf.loc[0:737].astype(int)
Use .iloc
or loc
depends on your index.
Upvotes: 1