Professional Documents
Culture Documents
Facebook - Jupyter Notebook
Facebook - Jupyter Notebook
Facebook - Jupyter Notebook
In [5]: df=pd.read_csv(r"C:\Users\Admin\eclipse\Downloads\pseudo_facebook.csv\pseudo_f
In [6]: df.head()
Out[6]: userid age dob_day dob_year dob_month gender tenure friend_count friendships_initi
In [38]: df.columns
In [39]: sub1=df['mobile_likes_received']
In [40]: sub1
Out[40]: 0 0
1 0
2 0
3 0
4 0
...
98998 11887
98999 10592
99000 11462
99001 5760
99002 9530
Name: mobile_likes_received, Length: 99003, dtype: int64
In [10]: subsets=df[['dob_day','likes','gender','mobile_likes','friendships_initiated']
In [11]: subsets
0 19 0 male 0 0
1 2 0 female 0 0
2 16 0 male 0 0
3 25 0 female 0 0
4 4 0 male 0 0
b.Merge Data
In [12]: df2=pd.read_csv(r"C:\Users\Admin\Desktop\ml_data\startup_funding.csv")
In [14]: df2.head(10)
Predictive
0 0 01/08/2017 TouchKin Technology Care Bangalore Kae Capital
Platform
Digital Triton
1 1 02/08/2017 Ethinos Technology Marketing Mumbai Investment
Agency Advisors
Online
Kashyap
platform for
Consumer Deorah, Anand
2 2 02/08/2017 Leverage Edu Higher New Delhi
Internet Sankeshwar,
Education
Deepak Jain,...
Services
Kunal Shah,
DIY
Consumer LetsVenture,
3 3 02/08/2017 Zepo Ecommerce Mumbai
Internet Anupam Mittal,
platform
Hetal ...
healthcare
Consumer Narottam Thudi,
4 4 02/08/2017 Click2Clinic service Hyderabad
Internet Shireesh Palle
aggregator
Reliance
Peer to Peer
Consumer Corporate
5 5 01/07/2017 Billion Loans Lending Bangalore
Internet Advisory
platform
Services Ltd
Energy
management Infuse
6 6 03/07/2017 Ecolibriumenergy Technology Ahmedabad
solutions Ventures, JLL
provider
Asset
Online
Management
marketplace
7 7 04/07/2017 Droom eCommerce Gurgaon (Asia) Ltd,
for
Digital Garage
automobiles
Inc
online
Kalaari Capital,
marketplace
8 8 05/07/2017 Jumbotail eCommerce Bangalore Nexus India
for food and
Capital Advisors
grocery
B2B International
marketplace Finance
9 9 05/07/2017 Moglix eCommerce Noida
for Industrial Corporation,
products Rocketship,...
Out[18]: userid age dob_day dob_year dob_month gender tenure friend_count friendships_initi
5 rows × 25 columns
c. Sort Data
In [22]: df3.sort_values(by='StartupName',ascending=False)
Out[22]: userid age dob_day dob_year dob_month gender tenure friend_count friendships_
d. Transposing Data
Out[24]: 0 1 2 3 4 5 6 7 8
userid 2094382 1192601 2083884 1203168 1733186 1524765 1136133 1680361 1365174
age 14 14 14 14 14 14 13 13 13
dob_day 19 2 16 25 4 1 14 4 1
dob_year 1999 1999 1999 1999 1999 1999 2000 2000 2000
dob_month 11 11 11 12 12 12 1 1 1
In [25]: df3.shape
In [36]: df.values.reshape((-1,1))
Out[36]: array([[2094382],
[14],
[19],
...,
[9530],
[0],
[2913]], dtype=object)
In [ ]: