Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SyntaxError: invalid syntax inside map(lambda (x, y)

This is the data in time column:

{'Thursday': {'0:00': 1, '23:00': 1, '21:00': 1}, 'Saturday': {'2:00': 1}, 'Monday': {'1:00': 1}}

But this code is giving me syntax error :

checkin_df['time_clean'] = map(lambda (x, y): map(lambda (k, v): map(lambda(i, value): [k, value, v.values()[i]], enumerate(v)), y.iteritems()), checkin_df['time'].iteritems())

I am getting the following error :

     checkin_df['time_clean'] = map(lambda (x, y): map(lambda (k, v): map(lambda(i, value): [k, value, v.values()[i]], enumerate(v)), y.iteritems()), checkin_df['time'].iteritems())
                                          ^
SyntaxError: invalid syntax

Which part am I missing ? Could you please help ?

like image 748
DukeLover Avatar asked Nov 19 '25 20:11

DukeLover


1 Answers

Try this (removed parenthesis):

checkin_df['time_clean'] = map(lambda x, y: map(lambda k, v: map(lambda i, value: [k, value, v.values()[i]], enumerate(v)), y.iteritems()), checkin_df['time'].iteritems())
like image 197
whackamadoodle3000 Avatar answered Nov 22 '25 09:11

whackamadoodle3000



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!