Skip to content
Advertisement

Tag: dataframe

Create pandas dataframe from multiple sources

I need to create a pandas dataframe using information from two different sources. For example, The first 3 columns in the dataframe I want should contain c1, c2, c3, and the rest of the columns come from the key of the returnedDict. The number of keys in the returnedDict is 100. How can I initialize such Dataframe and append the

How to clean survey data in pandas

Input: Output: here’s the data: d = {‘Morning’: [“Didn’t answer”, “Didn’t answer”, “Didn’t answer”, ‘Morning’, “Didn’t answer”], ‘Afternoon’: [“Didn’t answer”, ‘Afternoon’, “Didn’t answer”, ‘Afternoon’, “Didn’t answer”], ‘Night’: [“Didn’t answer”, ‘Night’, “Didn’t answer”, ‘Night’, ‘Night’], ‘Sporadic’: [“Didn’t answer”, “Didn’t answer”, ‘Sporadic’, “Didn’t answer”, “Didn’t answer”], ‘Constant’: [“Didn’t answer”, “Didn’t answer”, “Didn’t answer”, ‘Constant’, “Didn’t answer”]} I want the output to be:

Advertisement