0

I do not understand the below segment of code of use of replace() function in the python csv library.

Can someone please explain me the use of **c in the second line? Why is it used? Also if possible please explain the whole line of code.

# replace''with 0
cast0 = [{**c,'n':c['n'].replace('','0')} for c in casts]

cast0[3:5]
IanS
  • 14,753
  • 9
  • 56
  • 81
  • 3
    What is `casts`? Please provide a [mcve]. – IanS Jun 25 '19 at 13:18
  • here is the link to the whole python pandas documentation- https://buildmedia.readthedocs.org/media/pdf/pandasguide/latest/pandasguide.pdf here casts is just a .csv file which was opened by casts=list(csv.DictReader(open('cast.csv'))) – Nilutpol K Jun 25 '19 at 13:25
  • You need to include any relevant information in your question. See [How to ask](https://stackoverflow.com/help/how-to-ask) and [How to make pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples). – IanS Jun 25 '19 at 13:37
  • Until you can ask the question as a [mcve], I will vote to close the question as off-topic. – IanS Jun 25 '19 at 16:23

0 Answers0