The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
However the subdocuments will just appear as JSON inside the subdocument cell
from pandas import DataFrame
df = DataFrame(list(db.collection_name.find({}))
print(df)
how can I get a below 2nd table like this using python?
what is the approach for this?
Solved! Go to Solution.
Hi @sharath123
You can refer this code
import pandas as pd
from pandas import DataFrame,Series
df = pd.read_csv('1.csv',sep='\t')
df1 = df['address'].apply(eval).apply(Series)
df2 = pd.concat([df,df1],axis = 1)
df2.drop('address',axis =1, inplace = True)
df2.rename(columns={'number':'address.number','street':'address.street','city':'address.city'},inplace = True)
print(df2)
If something wrong please let me know .
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @sharath123
You can refer this code
import pandas as pd
from pandas import DataFrame,Series
df = pd.read_csv('1.csv',sep='\t')
df1 = df['address'].apply(eval).apply(Series)
df2 = pd.concat([df,df1],axis = 1)
df2.drop('address',axis =1, inplace = True)
df2.rename(columns={'number':'address.number','street':'address.street','city':'address.city'},inplace = True)
print(df2)
If something wrong please let me know .
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
78 | |
77 | |
37 | |
33 | |
31 |
User | Count |
---|---|
92 | |
81 | |
58 | |
48 | |
48 |