A problem with Pandas dataframe (Need help urgently)
I have a huge Excel data basis. I want to use Pandas to read and manipulate it
This works
import pandas as pd
xlsx = pd.ExcelFile(r'c:\vinsdeloire\Chinonrougegpsga1.xlsx')
cr1=pd.read_excel(xlsx,sheet_name='Données indiv campagne')# sheet_name= est facultatif
cr2=pd.read_excel(xlsx,sheet_name='Données indiv année civile')
cr3=pd.read_excel(xlsx,sheet_name='pilotage GPS')
cr1
I can have the head simply
cr1.head()
The the column names
for idx,column in enumerate(cr1.columns):
print(idx,column)
I can use the name of one column
cr1['Rotation stock en nb de mois campagne 2019-2020']
But what I do not understand is that until now a command like this one doesn't work
cr11=cr1.iloc[:-9,29]
cr11
given this error
Location based indexing can only have [integer, integer slice (START point is INCLUDED, END point is EXCLUDED), listlike of integers, boolean array] types
I make certainly a mistake and I cannot give more than my code but I do not see my error. And unfrotunately its very urgent. I will remove this later.
Thanks by advance
Could you please make the file
Chinonrougegpsga1.xlsx
accessible somewhere ?Do you mean something like
cr.iloc[9:29]
? Read the doc : https://pandas.pydata.org/pandas-docs...