Hello everybody!
I’m a bit stuck here… I created a DataFrame from a csv-file, subsetted it and wanted to do a list-comprehension. Everything works fine but the List ends after 99 elements. Does anyhody have an idea?
###Creating List
df_list = pd.read_csv(file, delimiter=";")
col = 'example'
liste_raw = df_list[col].tolist() #has 112 elements
liste = [i.replace("/","-") for i in liste_raw)] #this list always has 99 elements, no matter how big the input list is
Is there a fundamental mistake in this code? 
Would be great if anybody could help!
Thank you guys in advance!!!
Cheers
Felix
Are you sure that each row has a “/” or one of those 13 isn’t a null or nan?
Also, is liste
a column or a df?
If you want to change each row in a col I think you need to specify the df[col_name]
.
https://medium.com/@masonrchildress/how-to-perform-a-list-comprehension-on-your-dataframe-python-8548d3de7bd8
1 Like
Hey lisalisaj,
thanks for your response! Yes, I am sure about that.
I just restarted Jupyter Notebook and everything works 
Thank you again.
Best
Felix
1 Like
No, liste
is a list generated by list comprehension:
liste = [i.replace("/","-") for i in liste_raw)]
the column is the variable col = 'example'
Cheers
1 Like