Q:

How to fix error 'Writing 0 cols but got 4 aliases' in python using pandas

I'm trying to save some data scraped using selenium to CSV file using pandas, but I'm getting this error and I don't know what's the problem.
I tried to use header=False instead of the header=['','','',''],
it works without error but gave me an empty CSV file.
Error:
full_datas = list(zip(d_links, d_title, d_price, d_num))
df = pd.DataFrame(data=full_datas)
df.to_csv('cc.csv', encoding='utf-8-sig', index=False, header=['Links','Title,','Price','PNum'])

Empty csv:
full_datas = list(zip(d_links, d_title, d_price, d_num))
df = pd.DataFrame(data=full_datas)
df.to_csv('cc.csv', encoding='utf-8-sig', index=False, header=False)

I'm expecting a CSV file with my data on it
Traceback (most recent call last):
  File "E:/data/some/urls.py", line 90, in <module>
    df.to_csv('cc.csv', encoding='utf-8-sig', index=False, header=['Links','Title,','Price','PNum'])

  File "C:\Users\Iwillsolo\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\core\generic.py", line 3228, in to_csv
    formatter.save()

  File "C:\Users\Iwillsolo\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\io\formats\csvs.py", line 202, in save
    self._save()

  File "C:\Users\Iwillsolo\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\io\formats\csvs.py", line 310, in _save
    self._save_header()

  File "C:\Users\Iwillsolo\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\io\formats\csvs.py", line 242, in _save_header
    "aliases".format(ncols=len(cols), nalias=len(header))
ValueError: Writing 0 cols but got 4 aliases

A:

sometimes the list might be empty so i managed to fix it by using zip_longest
thank you guys for trying to help :)

