krishnadey30 / LeetCode-Questions-CompanyWise

Contains Company Wise Questions sorted based on Frequency and all time

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there a script to get the most commonly asked questions?

FrozenHearth opened this issue · comments

There are around 537 CSVs in the repo. I got a script to combine all the CSVs, but it was a huge mess, because the combined CSV file was 31 mb, and the formatting was all messed up. Basically, I wanted to create a CSV to order by the most frequently asked questions from all these companies.

import os
import glob
import pandas as pd
os.chdir('/mydir')

#find all csv files in the folder
#use glob pattern matching -> extension = 'csv'
#save result in list -> all_filenames
extension = 'csv'
all_filenames = [i for i in glob.glob('*.{}'.format(extension))]
#print(all_filenames)

#combine all files in the list
combined_csv = pd.concat([pd.read_csv(f) for f in all_filenames], axis=1)
#export to csv
combined_csv.to_csv( "aaaaa.csv", index=False, encoding='utf-8-sig')