for iterator in iterable sequence
for item in my_list:
print(item)
for i in range(int_val):
print(i)
range(int_val)
for char in username:
print(char) #will print the username letters one after the other in a new row
for key, value in my_dictionary.items():
print(key, value)
for value in np.nditer(my_np_array):
print(value)
my_df = pd.read_csv("my_data.csv", index_col = 0)
for value in my_df:
print(value) #gives you the column names of the data frame
for label, observation in my_df.iterrows():
print(label)
print(observation) #this is an entire series object, and memory resource demanding
print(observation["header"]) #show the values the column "header"
my_df.loc[label, "new_name"] = o["name"].upper() #adds column with upper case value
my_df = pd.read_csv("my_data.csv", index_col = 0)
my_df["length"] = my_df["name"].apply(len) #gives length for name in column "length"
for p in prices:
if p > 10:
print("more than 10")
elif p < 5:
print("less than 5")
else:
print("5 to 10")
while i < 6:
print(i)
i += 1
while i < 6:
print(i)
if i == 3:
break
i += 1