I would like to convert this XML file: to this CSV file: I can have several bodies of ID structures. I use the lxml library. I tried with the xpath method and for loop but I can only get the ID but not the rest. The problem is the second for loop, but I don’t know how to deal with
Tag: csv
Why does read_csv skiprows value need to be lower than it should be in this case?
I have a log file (Text.TXT in this case): To read in this log file into pandas and ignore all the header info I would use skiprows up to line 16 like so: But this produces EmptyDataError as it is skipping past where the data is starting. To make this work I’ve had to use it on line 11: My
How to Access Private Github Repo File (.csv) in Python using Pandas or Requests
I had to switch my public Github repository to private and cannot access files, not with access tokens that I was able to with the public Github repo. I can access my private repo’s CSV with curl: ”’ curl -s https://{token}@raw.githubusercontent.com/username/repo/master/file.csv ”̵…
Import Data from .csv file into mysql using python
I am trying to import data from two columns of a .csv file (time hh:mm, float). I created a database and a table in mysql. If I run the program with executemany(), result is the following: [’01:00′, ‘1’] ‘-1 was inserted.’ and after this I do get the error code: Not all par…
CSV data to MySQL table
I am trying to insert rows from a csv file into a MySQL table. I tried this code Nb: tab is a table with two columns name (varchar 20) and nb_cases (double) I get this error: DataError: (1265, “Data truncated for column ‘nb_cases’ at row 1”) Answer your number doesn’t fit it must…
Split CSV values on single row into individual rows
I have a Python script that outputs a text file with thousands of random filenames in a comma separated list, all on a single row. I want to take each value in the list and put it into its own row in a new CSV file. I’ve tried some variations of awk with no success. What’s the best way to
How to remove NaN on CSV?
I have a .csv file of a table consisting of 12 col and 30k rows. One of the col is ‘mentions’, some of the data are empty (NaN). I am trying to remove all the rows where mentions = NaN. I don’t want to fill it with new data. I just wanna remove those rows so they wont be part
Python: Write list of lists to CSV
In my python script I’m having a list that has the following structure: and so on. I want to write this list to csv file in a way that every element is in separate row and every string in one element is in separate column. So I want to end up with the following result in csv file: Currently I
How to use spacy to do Name Entity recognition on CSV file
I have tried so many things to do name entity recognition on a column in my csv file, i tried ne_chunk but i am unable to get the result of my ne_chunk in columns like so Instead after using this code, i got this error So, i am wondering if i could do this using spaCy which is another thing
Outlier removal Isolation Forest
I’ve been trying to remove outliers from my database using isolation forest, but I can’t figure out how. I’ve seen the examples for credit card fraud and Salary but I can’t figure out how to apply them on each column as my database consists of 3862900 rows and 19 columns. I’ve up…