See this issue.
next() needs to work with an iterator. You could create one with intertools,
import itertools
mks = itertools.cycle(['o', 'x', '^', '+', '*', '8', 's', 'p', 'D', 'V'])
markers = [next(mks) for i in df["category"].unique()]
Example:
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
dic={"A":[4,6,5], "B":[2,7,5], "category":['A','A',"B"]}
df=pd.DataFrame(dic)
import itertools
mks = itertools.cycle(['o', 'x', '^', '+', '*', '8', 's', 'p', 'D', 'V'])
markers = [next(mks) for i in df["category"].unique()]
sns.lmplot('A', 'B', data=df, hue='category', markers=markers, fit_reg=False)
plt.show()
Note that this may be a bit overkill and you can simply get the markers fromt the list directly,
marker = ['o', 'x', '^', '+', '*', '8', 's', 'p', 'D', 'V']
markers = [marker[i] for i in range(len(df["category"].unique()))]
Complete example:
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
dic={"A":[4,6,5], "B":[2,7,5], "category":['A','A',"B"]}
df=pd.DataFrame(dic)
marker = ['o', 'x', '^', '+', '*', '8', 's', 'p', 'D', 'V']
markers = [marker[i] for i in range(len(df["category"].unique()))]
sns.lmplot('A', 'B', data=df, hue='category', markers=markers, fit_reg=False)
plt.show()
Both solutions from above result in the same plot:
