Skip to content

Count lines of code in directory using Python

I have a project whose lines of code I want to count. Is it possible to count all the lines of code in the file directory containing the project by using Python? Answer To count all the lines of code in the files in a directory, call the “countIn” function, passing the directory as a parameter.

Could pandas use column as index?

I have a spreadsheet like this: I don’t want to manually swap the column with the row. Could it be possible to use pandas reading data to a list as this: Answer Yes, with pandas.DataFrame.set_index you can make ‘Locality’ your row index. If inplace=True is not provided, set_index returns the…