Capgemini Data Engineer Interview Question - Round 1 | Save Multiple Columns in the DataFrame |

  Рет қаралды 15,630

GeekCoders

GeekCoders

Күн бұрын

Пікірлер: 27
@sourav_sarkar_2000
@sourav_sarkar_2000 9 ай бұрын
# creating a dict of columns as to avoid checking multiple datatypes d={} for col in df.dtypes: if col[1] not in d: d[col[1]] = [col[0]] else:d[col[1]].append(col[0]) for key,val in d.items(): df.select(val).show() # write df to the location
@kunuturuaravindreddy5879
@kunuturuaravindreddy5879 3 ай бұрын
very good you are posting real interview questions many of them simply explain concer defentitiins
@GeekCoders
@GeekCoders 3 ай бұрын
@@kunuturuaravindreddy5879 thanks
@Offical_PicturePerfect
@Offical_PicturePerfect 3 ай бұрын
int_cols = [col for col, dtype in df.dtypes if dtype == 'int'] string_cols = [col for col, dtype in df.dtypes if dtype == 'string'] float_cols = [col for col, dtype in df.dtypes if dtype == 'float'] Creating DataFrames for each data type int_df = df.select(int_cols) string_df = df.select(string_cols) float_df = df.select(float_cols)
@sourav_sarkar_2000
@sourav_sarkar_2000 9 ай бұрын
# creating a dict of columns to avoid checking multiple datatypes d={} for col in df.dtypes: if col[1] not in d: d[col[1]] = [col[0]] else:d[col[1]].append(col[0]) print(d) for key,val in d.items(): df.select(val).show() # write df to the location # df.write.mode('overwrite').save(f'temp_loc/{key}')
@myl1566
@myl1566 10 ай бұрын
Good problem to solve. Thanks for posting sagar!
@GeekCoders
@GeekCoders 10 ай бұрын
Thank you
@aamirmansuri69
@aamirmansuri69 10 ай бұрын
Thank you for posting this video. But, can you please post pyspark interview questions for freshers. Thank you!
@Dataengineeringlearninghub
@Dataengineeringlearninghub 10 ай бұрын
Great problem sagar
@rawat7203
@rawat7203 10 ай бұрын
My Way Sir intType = [] stringType = [] floatType = [] for i in df.dtypes: if i[1] == 'int': intType.append(i[0]) elif i[1] == 'string': stringType.append(i[0]) elif i[1] == 'float': floatType.append(i[0]) dfInt = df.select(*intType) dfString = df.select(*stringType) dfFloat = df.select(*floatType)
@GeekCoders
@GeekCoders 10 ай бұрын
Nice
@rawat7203
@rawat7203 10 ай бұрын
Thanks a lot Sir
@GeekCoders
@GeekCoders 10 ай бұрын
Thank you
@vutv5742
@vutv5742 10 ай бұрын
Completed 👏
@pradishpranam6175
@pradishpranam6175 9 ай бұрын
cool question
@ug1880
@ug1880 9 ай бұрын
Were u asked for any imocha test ?
@GeekCoders
@GeekCoders 9 ай бұрын
No
@ug1880
@ug1880 9 ай бұрын
@@GeekCoders okk...
@Nextgentrick
@Nextgentrick 9 ай бұрын
Shouldn’t you use append instead of overwrite
@pratyushkumar8567
@pratyushkumar8567 10 ай бұрын
Hi Sagar this Capgemini Data Engineer Interview Question - Round 1 | Save Multiple Columns in the DataFrame what was the experience the candidate has ?
@GeekCoders
@GeekCoders 10 ай бұрын
4 years
@bhumikalalchandani321
@bhumikalalchandani321 10 ай бұрын
okay, is this internal functionality of conversion to parq format
@rawat7203
@rawat7203 10 ай бұрын
yes
@2412_Sujoy_Das
@2412_Sujoy_Das 10 ай бұрын
My solution is as follows: string = df integer = df float = df for i in df.dtypes: if i[1]!='string' and i[1]=='int': string = string.drop(i[0]) float = float.drop(i[0]) elif i[1]!='string' and i[1]=='float': string = string.drop(i[0]) integer = integer.drop(i[0]) elif i[1]!='int' and i[1]=='string': integer = integer.drop(i[0]) float = float.drop(i[0]) elif i[1]!='int' and i[1]=='float': integer = integer.drop(i[0]) string = string.drop(i[0]) elif i[1]!='float' and i[1]=='string': float = float.drop(i[0]) integer = integer.drop(i[0]) else: float = float.drop(i[0]) string = string.drop(i[0]) print(string) print(integer) print(float)
@SouvikMitul
@SouvikMitul 6 ай бұрын
my solution: dict={} for i in df.dtypes: if i[1] in dict.keys(): l=dict.get(i[1]) l.append(i[0]) dict.update({i[1]:l}) else: l=[] l.append(i[0]) dict.update({i[1]:l}) for i in dict.keys(): df_s=df.select(dict.get(i)) df_s.show() ##did show instead of writing
This Game Is Wild...
00:19
MrBeast
Рет қаралды 174 МЛН
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 132 МЛН
Молодой боец приземлил легенду!
01:02
МИНУС БАЛЛ
Рет қаралды 2 МЛН
How I Prepare for Data Engineering Interviews?
13:19
GeekCoders
Рет қаралды 6 М.
Day 30:- Virtusa Data Engineer Interview Question 2nd Round
39:42
DEwithAbhishekTripathi
Рет қаралды 909
Walmart PySpark Interview Question | Data Engineering |
15:04
GeekCoders
Рет қаралды 2,9 М.
Don't Learn Machine Learning, Instead learn this!
6:21
Deepchand O A
Рет қаралды 98 М.
This Game Is Wild...
00:19
MrBeast
Рет қаралды 174 МЛН