You can also use the .to_frame()
method.
If it is a Series, I assume 'Gene' is already the index, and will remain the index after converting it to a DataFrame. The name
argument of .to_frame()
will name the column.
x = x.to_frame('count')
If you want them both as columns, you can reset the index:
x = x.to_frame('count').reset_index()