Skip to content
Advertisement

Tag: dataframe

Writing a pandas DataFrame to CSV file

I have a dataframe in pandas which I would like to write to a CSV file. I am doing this using: And getting the following error: Is there any way to get around this easily (i.e. I have unicode characters in my data frame)? And is there a way to write to a tab delimited file instead of a CSV

How to split a dataframe string column into two columns?

I have a data frame with one (string) column and I’d like to split it into two (string) columns, with one column header as ‘fips’ and the other ‘row’ My dataframe df looks like this: I do not know how to use df.row.str[:] to achieve my goal of splitting the row cell. I can use df[‘fips’] = hello to add

pandas: filter rows of DataFrame with operator chaining

Most operations in pandas can be accomplished with operator chaining (groupby, aggregate, apply, etc), but the only way I’ve found to filter rows is via normal bracket indexing This is unappealing as it requires I assign df to a variable before being able to filter on its values. Is there something more like the following? Answer I’m not entirely sure

Advertisement