Python DataFrame Learning
1 Getting the first column of a Pandas DataFrame as a Series results in a Pandas Series object representing the first column.
df = pd.DataFrame({"Letters": ["a", "b", "c"], "Numbers": [1, 2, 3]})
first_column = df.iloc[:, 0]
get first column of df
print(first_column)
Reference Link
(Python help)[https://www.adamsmith.haus/python/answers/how-to-get-the-first-column-of-a-pandas-dataframe-as-a-series-in-python]
2 Matplotlib ticks You could explicitly set where you want to tick marks with plt.xticks
import numpy as np
import matplotlib.pyplot as plt
x = [0,5,9,10,15]
y = [0,1,2,3,4]
plt.plot(x,y)
plt.xticks(np.arange(min(x), max(x)+1, 1.0))
plt.show()
3 Series and dataframe: the relationship
Series can only contain single list with index, whereas dataframe can be made of more than one series or we can say that a dataframe is a collection of series that can be used to analyse the data.

浙公网安备 33010602011771号