I have a dataframe with a column “CCR” whose values are as such : “Aaaa;Bbbb;Cccc”, or “Bbbb;;Cccc”, or “Cccc;Bbbb;Aaaa” or just “Bbbb”. I would like to extract the last substring part (after the “;”) and put it into another column “LastCCR”. If there is only one value and therefore no ‘;’ then the value stays the same in the LastCCR
Tag: delimiter
Count no. of delimiters in line while ignoring the delimiter which is part of data value
I am reading one big csv file line by line and I want to count the no. of delimiters in each line. But if the delimiter is part of data value, then it should not be counted. Few records of data set: In all 3 lines, number of actual commas (which divides the data into multiple columns) are only 2
How to create multiple delimited files in python?
I have a program that converts CSV files into pipe delimited files and also counts the total no of lines. But in this case, if the total no of lines is above 7000, I want to create a new output file. The situation would be adjusting just 7000 lines in one file and creating every other output files for every
Convert commas decimal separators to dots within a Dataframe
I am importing a CSV file like the one below, using pandas.read_csv: Example of CSV file: The problem is that when I later on in my code try to use these values I get this error: TypeError: can’t multiply sequence by non-int of type ‘float’ The error is because the number I’m trying to use is not written with a
Adding delimiters and removing commas
I have a file from which I’ve output several columns of information, 4 to be exact. At this moment they are separated by commas, but in order for my buddy to feed them into another script, he wants the format to be with ‘|’ as delimiter and the commas removed. The commas follow every set of data, so after my