Python dictionary comprehension with Pandas
Python dictionary comprehension with Pandas Question: I am trying to create a dictionary from two columns of a DataFrame (df) mydict={x :y for x in df[‘Names’] for y in df[‘Births’]} But all of the values are the same(the last value in the column)! {‘Bob’: 973, ‘Jessica’: 973, ‘John’: 973, ‘Mary’: 973, ‘Mel’: 973} I checked …
Total answers: 2