0

Python

value[value==' ']='Unknown' .how this line work.plz explain

26th Apr 2020, 4:30 PM
Lalis
Lalis - avatar
6 Respostas
+ 3
In Python, True is 1 in index context, and False is 0 ;)
26th Apr 2020, 4:35 PM
visph
visph - avatar
+ 1
Subash Rogers my bad: I should have said "in list index context": https://code.sololearn.com/cR0KMt5YeEk9/?ref=app
26th Apr 2020, 4:42 PM
visph
visph - avatar
0
If value is empty key True will hold 'Unknown' else False will hold 'Unknown' in the list value
26th Apr 2020, 4:35 PM
Subash
Subash - avatar
0
Sorry i forgot to say i found that line in pandas dataframe .that was different
26th Apr 2020, 4:47 PM
Lalis
Lalis - avatar
0
That's not impossible that Pandas use the magic method __index__ as list does for their array: RTFM to know ;)
26th Apr 2020, 4:59 PM
visph
visph - avatar