Kyle R. Conway
Follow

Anyone got good tutorial recommendations for using python (and it seems pandas) to parse, re-arrange, and retool csv files. At the moment I'm looking for a good way to:

1) Add a header name to the only column containing data *without* also having a header name

2) Delete columns without having to explicitly name all the header names I'd like to remove.

3) Learn more about this in general.

Resources/recommendations appreciated as I begin this particular journey.

:)

@K_REY_C pandas is the way to go, though you'll need to invest some time to understand it's logic as it's not the most intuitive. Typically you can solve problems in multiple ways. For large files you also need to be careful not to go against it's grain, otherwise performance suffers.

@phiofx Pandas seems to be what I want. Any recommendations for guides to understand the logic? I'm more fluent with SQL queries than I publicly admit, and I think that type of functionality is what I'd like from pandas, but I've yet to see something that has helped with that logic. If you've got any specific recommendations or guides I'm all ears!

@K_REY_C the documentation is quite comprehensive in terms of covering funcionality (with lots of examples). The main object that will store your csv data is a dataframe which you can then can reshape in various ways, eg pandas.pydata.org/pandas-docs/

Sign in to participate in the conversation
Mastodon

Follow friends and discover new ones. Publish anything you want: links, pictures, text, video. This server is run by the main developers of the Mastodon project. Everyone is welcome as long as you follow our code of conduct!