I have a dataframe like such:
>>> import pandas as pd
>>> pd.read_csv('csv/10_no_headers_with_com.csv')
//field field2
0 //first field is time NaN
1 132605 1.0
2 132750 2.0
3 132772 3.0
4 132773 4.0
5 133065 5.0
6 133150 6.0
I would like to add another field that says whether the first value of the first field is a comment character, //
. So far I have something like this:
# may not have a heading value, so use the index not the key
df[0].str.startswith('//')
What would be the correct way to add on a new column with this value, so that the result is something like:
pd>>> pd.read_csv('csv/10_no_headers_with_com.csv', header=None)
0 1 _starts_with_comment
0 //field field2 True
1 //first field is time NaN True
2 132605 1 False
3 132750 2 False
4 132772 3 False