{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import pandas as pd\n\nsample_sub = pd.read_csv('../input/AI4Code/sample_submission.csv')\nsample_sub","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-06-22T07:27:18.782858Z","iopub.execute_input":"2022-06-22T07:27:18.783384Z","iopub.status.idle":"2022-06-22T07:27:18.843985Z","shell.execute_reply.started":"2022-06-22T07:27:18.783253Z","shell.execute_reply":"2022-06-22T07:27:18.84265Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_sub['cell_count'] = sample_sub.cell_order.apply(lambda x: len(x.split()))","metadata":{"execution":{"iopub.status.busy":"2022-06-22T07:29:07.683059Z","iopub.execute_input":"2022-06-22T07:29:07.683566Z","iopub.status.idle":"2022-06-22T07:29:07.69888Z","shell.execute_reply.started":"2022-06-22T07:29:07.68353Z","shell.execute_reply":"2022-06-22T07:29:07.697433Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"more = sample_sub[sample_sub.cell_count>16]\nless = sample_sub[sample_sub.cell_count<=16]","metadata":{"execution":{"iopub.status.busy":"2022-06-22T07:29:10.03072Z","iopub.execute_input":"2022-06-22T07:29:10.03239Z","iopub.status.idle":"2022-06-22T07:29:10.049063Z","shell.execute_reply.started":"2022-06-22T07:29:10.032299Z","shell.execute_reply":"2022-06-22T07:29:10.047726Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import random\ndef shuffle_cell_orders(cell_order): \n    cells = cell_order.split()\n    random.shuffle(cells)\n    return ' '.join(cells)\n\nless.cell_order = less.cell_order.apply(shuffle_cell_orders)","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.concat([less, more])\n\ndf[['id', 'cell_order']].to_csv('submission.csv', index=False)","metadata":{},"execution_count":null,"outputs":[]}]}