Skip to main content
Question Protected by cs95
deleted 48 characters in body; edited tags
Source Link
smci
  • 33.6k
  • 21
  • 116
  • 149

I have a dataframe..:

s1 = pd.Series([5, 6, 7])
s2 = pd.Series([7, 8, 9])

df = pd.DataFrame([list(s1), list(s2)],  columns =  ["A", "B", "C"])

   A  B  C
0  5  6  7
1  7  8  9

[2 rows x 3 columns]

and I need to add a first row [2, 3, 4] to get..:

   A  B  C
0  2  3  4
1  5  6  7
2  7  8  9

I've tried append()append() and concat()concat() functions but somehow I can't find the right way how to do that.

Any ideas? Is there any direct way howHow to add/insert series to dataframe?

I have a dataframe..

s1 = pd.Series([5, 6, 7])
s2 = pd.Series([7, 8, 9])

df = pd.DataFrame([list(s1), list(s2)],  columns =  ["A", "B", "C"])

   A  B  C
0  5  6  7
1  7  8  9

[2 rows x 3 columns]

and I need to add a first row [2, 3, 4] to get..

   A  B  C
0  2  3  4
1  5  6  7
2  7  8  9

I've tried append() and concat() functions but somehow I can't find the right way how to do that.

Any ideas? Is there any direct way how to add/insert series to dataframe?

I have a dataframe:

s1 = pd.Series([5, 6, 7])
s2 = pd.Series([7, 8, 9])

df = pd.DataFrame([list(s1), list(s2)],  columns =  ["A", "B", "C"])

   A  B  C
0  5  6  7
1  7  8  9

[2 rows x 3 columns]

and I need to add a first row [2, 3, 4] to get:

   A  B  C
0  2  3  4
1  5  6  7
2  7  8  9

I've tried append() and concat() functions but can't find the right way how to do that.

How to add/insert series to dataframe?

added 1 character in body
Source Link
BenMorel
  • 35.9k
  • 51
  • 197
  • 331

I have a dataframe..

s1 = pd.Series([5, 6, 7])
s2 = pd.Series([7, 8, 9])

df = pd.DataFrame([list(s1), list(s2)],  columns =  ["A", "B", "C"])

   A  B  C
0  5  6  7
1  7  8  9

[2 rows x 3 columns]

and I need to add a first row [2, 3, 4] to get..

   A  B  C
0  2  3  4
1  5  6  7
2  7  8  9

I've tried append() and concat() fuctionsfunctions but somehow I can't find the right way how to do that.

Any ideas? Is there any direct way how to add/insert series to dataframe?

I have a dataframe..

s1 = pd.Series([5, 6, 7])
s2 = pd.Series([7, 8, 9])

df = pd.DataFrame([list(s1), list(s2)],  columns =  ["A", "B", "C"])

   A  B  C
0  5  6  7
1  7  8  9

[2 rows x 3 columns]

and I need to add a first row [2, 3, 4] to get..

   A  B  C
0  2  3  4
1  5  6  7
2  7  8  9

I've tried append() and concat() fuctions but somehow I can't find the right way how to do that.

Any ideas? Is there any direct way how to add/insert series to dataframe?

I have a dataframe..

s1 = pd.Series([5, 6, 7])
s2 = pd.Series([7, 8, 9])

df = pd.DataFrame([list(s1), list(s2)],  columns =  ["A", "B", "C"])

   A  B  C
0  5  6  7
1  7  8  9

[2 rows x 3 columns]

and I need to add a first row [2, 3, 4] to get..

   A  B  C
0  2  3  4
1  5  6  7
2  7  8  9

I've tried append() and concat() functions but somehow I can't find the right way how to do that.

Any ideas? Is there any direct way how to add/insert series to dataframe?

added 64 characters in body
Source Link
Meloun
  • 14.7k
  • 17
  • 68
  • 93

I have a dataframe..

s1 = pd.Series([5, 6, 7])
s2 = pd.Series([7, 8, 9])

df = pd.DataFrame([list(s1), list(s2)],  columns =  ["A", "B", "C"])

   A  B  C
0  5  6  7
1  7  8  9

[2 rows x 3 columns]

and I need to add a first row [2, 3, 4] to get..

   A  B  C
0  2  3  4
1  5  6  7
2  7  8  9

I've tried append() and concat() fuctions but somehow I can't find the right way how to do that.

Any ideas? Is there any direct way how to add/insert series to dataframe?

I have a dataframe..

s1 = pd.Series([5, 6, 7])
s2 = pd.Series([7, 8, 9])

df = pd.DataFrame([list(s1), list(s2)],  columns =  ["A", "B", "C"])

   A  B  C
0  5  6  7
1  7  8  9

[2 rows x 3 columns]

and I need to add a first row [2, 3, 4] to get..

   A  B  C
0  2  3  4
1  5  6  7
2  7  8  9

I've tried append() and concat() fuctions but somehow I can't find the right way how to do that.

Any ideas?

I have a dataframe..

s1 = pd.Series([5, 6, 7])
s2 = pd.Series([7, 8, 9])

df = pd.DataFrame([list(s1), list(s2)],  columns =  ["A", "B", "C"])

   A  B  C
0  5  6  7
1  7  8  9

[2 rows x 3 columns]

and I need to add a first row [2, 3, 4] to get..

   A  B  C
0  2  3  4
1  5  6  7
2  7  8  9

I've tried append() and concat() fuctions but somehow I can't find the right way how to do that.

Any ideas? Is there any direct way how to add/insert series to dataframe?

Source Link
Meloun
  • 14.7k
  • 17
  • 68
  • 93
Loading